ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do you hide a row if a certain cell equals zero? (https://www.excelbanter.com/excel-programming/326864-how-do-you-hide-row-if-certain-cell-equals-zero.html)

msqueenjessica

How do you hide a row if a certain cell equals zero?
 
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

Mark

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


Dave Peterson[_5_]

How do you hide a row if a certain cell equals zero?
 
You may want to apply Data|Filter|autofilter to that range (or just that
column).

Then filter on the non-zero values (custom|does not equal|0)

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


--

Dave Peterson


All times are GMT +1. The time now is 03:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com