Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code problem | Excel Discussion (Misc queries) | |||
Alt Code Problem | Excel Discussion (Misc queries) | |||
XLS to CSV Code Problem | Excel Worksheet Functions | |||
Code Problem | Excel Programming | |||
Code problem | Excel Programming |