automaticly deleting or omitting rows based on values


Posted by Rob Fronzaglio on January 09, 2002 8:50 AM

How do I automaticly omit or delete whole rows from a worksheet it that row contains the value of zero calculated from a different worksheet. the whole row must be deleted or omitted because the rows below the unwanted data needs to move up when the sheet is printed. Thanks for all the help.

Posted by Scott on January 09, 2002 8:59 AM

An easy way without using code would be the Auto filter.



Posted by Nate Oliver on January 09, 2002 2:44 PM

This ought to work, change the range to the appropriate one.


Sub delete()
Application.ScreenUpdating = False
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "0" Then
Cell.Value = "delete"
End If
Next Cell
Range("a1:a500").Select
For Each Cell In Selection
If Cell.Value = "delete" Then Cell.EntireRow.Delete
Next Cell
Range("a1").Select
Application.ScreenUpdating = True
End Sub

Cheers,


Nate