S
Sige
Hi There,
Underneath macro works fine to delete the empty rows in my used-range
on the active sheet.
I want to run this procedure on all my sheets ... but the looping
fails!
While looping the sheet does not become active?
Sub DeleteEmptyRows()
Dim LastRow As Long
Dim l As Long
Dim wsh As Worksheet
On Error GoTo err
Application.ScreenUpdating = False
'For Each wsh In ActiveWorkbook.Worksheets
' With wsh
LastRow = ActiveSheet.UsedRange.Row - 1 +
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For l = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(l)) = 0 _
Then Rows(l).Delete
Next l
' End With
'Next wsh
err:
End Sub
Hope you can help,
Sige
Underneath macro works fine to delete the empty rows in my used-range
on the active sheet.
I want to run this procedure on all my sheets ... but the looping
fails!
While looping the sheet does not become active?
Sub DeleteEmptyRows()
Dim LastRow As Long
Dim l As Long
Dim wsh As Worksheet
On Error GoTo err
Application.ScreenUpdating = False
'For Each wsh In ActiveWorkbook.Worksheets
' With wsh
LastRow = ActiveSheet.UsedRange.Row - 1 +
ActiveSheet.UsedRange.Rows.Count
Application.ScreenUpdating = False
For l = LastRow To 1 Step -1
If Application.WorksheetFunction.CountA(Rows(l)) = 0 _
Then Rows(l).Delete
Next l
' End With
'Next wsh
err:
End Sub
Hope you can help,
Sige