View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jonsson[_8_] Jonsson[_8_] is offline
external usenet poster
 
Posts: 1
Default Problem with this code

Hi,

I have found this code, posted by "NO SPAM".

Somehow I get an error at "If" after "step-1".
Whats wrong?
I think this code would help me to get what I need, but I cant get i
work like this.

Thanks in advance

//Thomas


Sub CleanUp()
Dim CurrentRow As Long
Dim UsedRows As Range
On Error GoTo Abort
Set UsedRows = ActiveSheet.UsedRange.Rows
For CurrentRow = UsedRows.Rows.Count To 1 Step -1
If
Application.WorksheetFunction.Sum(UsedRows.Rows(Cu rrentRow).Columns("B:B"))
= 0 Then
UsedRows.Rows(CurrentRow).EntireRow.Hidden = True
Else UsedRows.Rows(CurrentRow).EntireRow.Hidden =
False
End If
Next CurrentRow
' If only hiding for printing purposes, use the next two lines to prin
or
preview then restore the worksheet
'ActiveWindow.SelectedSheets.PrintPreview
'ActiveSheet.Rows.EntireRow.Hidden = False
Abort:
End Su

--
Message posted from http://www.ExcelForum.com