Dim myLastCol As Long
Dim wks As Worksheet
Dim dummyRng As Range
With wks
myLastRow = 0
myLastCol = 0
Set dummyRng = .UsedRange
On Error Resume Next
myLastRow = _
.Cells.Find("*", after:=.Cells(1), _
LookIn:=xlFormulas, lookat:=xlWhole, _
searchdirection:=xlPrevious, _
searchorder:=xlByRows).Row
myLastCol = _
.Cells.Find("*", after:=.Cells(1), _
LookIn:=xlFormulas, lookat:=xlWhole, _
searchdirection:=xlPrevious, _
searchorder:=xlByColumns).Column
On Error GoTo 0
.Columns.Delete
Else
.Range(.Cells(myLastRow + 1, 1), _
.Cells(.Rows.Count, 1)).EntireRow.Delete
.Range(.Cells(1, myLastCol + 1), _
.Cells(1, .Columns.Count)).EntireColumn.Delete
End If
End With
Next wks
Tried to run but it stopped at below point:
ReplyDelete.Range(.Cells(myLastRow + 1, 1), _
Sound strange, I used Office 2010 don't know if there is an impact if you have a different version maybe.
ReplyDeleteTry to access first the .Range to see where your error is.
Cannot give you more advises....
This comment has been removed by a blog administrator.
ReplyDeleteHow long did your 59M file take to run through the macro?
ReplyDeleteIt was a very long time ago i do not remember and i can't find the original file, sorry
ReplyDeletewill it work if I have a lot of cells with zeros in them inwhich I need?
ReplyDeleteIt worth trying it, i think yes but not sure
ReplyDeletePositive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. compress jpeg to 100kb
ReplyDeleteThat code worked perfectly with me ... Thanx too too too much for you ...
ReplyDeleteHello It’s really a nice and helpful piece of info. I am happy that you shared this helpful info with us. Please stay us informed like this. Thank you for sharing. bye
ReplyDeleteThanks the code is working on my excel sheet.
ReplyDelete