Hi Conor,
Here is a simple macro that when executed will delete rows filled with zeros on the active worksheet. It figures out on its own how many rows and columns there are and will not delete rows that do not have all zeros out to the last filled column.
Sub DeleteZeroRows()
' This macro deletes all rows on the active worksheet
' that have data cells that are filled with all zeros
' out to some column and are empty thereafter.
' Important: does not delete rows with empty cells
Dim LastCol As Integer
Dim iRow As Long
Dim iCol As Integer
For iRow = ActiveSheet.UsedRange.Rows.Count To 1 Step -1
LastCol = Cells(iRow, 255).End(xlToLeft).Column
For iCol = 1 To LastCol
If Cells(iRow, iCol) <> 0 Or IsEmpty(Cells(iRow, iCol)) Then GoTo SkipRow
Next iCol
Rows(iRow).Delete
SkipRow:
Next iRow
End Sub
If you want it to recognize empty cells as zeros, then just eliminated the
Or IsEmpty(Cells(iRow, iCol))
from the code above. This would then also delete empty rows. Or rows having zeros and empty cells intermixed.
Happy computing.
Damon
thanks dude,
works a charm - you the man.
appreciated
Conor