-
macro do not work
hello
the following macro can be found in john walkenbach's book
"excel 2002 vba programming" - page 305.it do not work.
[VBA]
Sub deleteEmptyrows()
Dim row
Dim LastRow As Long, r As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
LastRow = LastRow + ActiveSheet.UsedRange.row - 1
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(row(r)) = 0 Then
row(r).Delete
End If
Next
End Sub
[/VBA]
please help
thanks
moshe
-
ARe you sure that you haven't mis-transcribed that Moshe?
Where you have row(r), try Rows(r) (two places in the code).
-
Try Rows(r) instead of row(r)
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
-
Don't you need to do this in order to see your changes? Dave
[VBA]
Application.ScreenUpdating = True
[/VBA]
-
hi lior03,
here is the code...
[VBA]Sub deleteEmptyrows()
Dim row
Dim LastRow As Long, r As Long
LastRow = ActiveSheet.UsedRange.Rows.Count
LastRow = LastRow + ActiveSheet.UsedRange.row - 1
Application.ScreenUpdating = False
For r = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(r)) = 0 Then
Rows(r).Delete
End If
Next
End Sub
[/VBA]
regards
cckfm2000
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules