Hi all,
I´m trying to "clean" the worksheet from unused rows before printing
and then get a print out that only shows whats necessary. The "cleaned
area is different every time, depending wether there are numbers i
them or not. I´m using the code below, (thanks NOSPAM), but I get
very long "answertime" from this code. Is there anyway to modify it t
work from D5:D206? I think it would go faster if the area is specifie
to D5:D206, than to the bottom row, or.......?
I assume I have to modify it more than just change the area B:B
becouse that doesnt work.
Thanks in advance!
//Thomas
Sub CleanUporg()
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
I
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