How do you hide a row if a certain cell equals zero?
This code has two functions. First, it will unhide any rows that you may
have previously hidden that no longer contain a '0' value... and the second
part hides all the rows that do contain '0' values.
Sub Your_name_here
Dim i As Long
With Application
.ScreenUpdating = False
Sheets("Sheet Name Here").Select
Range("Range of cells you are checking - the column").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) < 0 Then
Selection.Rows(i).EntireRow.Hidden = False
End If
Next i
Sheets("Sheet Name Here").Select
Range("Range of cells you are checking").Select
For i = Selection.Cells.Count To 1 Step -1
If Selection.Cells(i) = 0 Then
Selection.Rows(i).EntireRow.Hidden = True
End If
Next i
end with
end sub
"msqueenjessica" wrote:
Hi
I'm trying to create a shipping report for work, based on another
spreadsheet. I need to know how to hide and entire row once all units have
shipped. As it is now, the report just lists "units due" as "0". Is there a
formula that will hide that row when the "units due" cell is "0".
Thanks
|