Hide rows with zero value in Multiple sheets

issa abu Hamameh - Apr 12, 2010 at 08:30 AM
 Excellent answer - Jul 10, 2013 at 01:49 PM
Please help me in making a macro in the Excelsheet that:
I can hide the entire rows if a cell value or (range of values) has a zero value in multiple sheets??? I mean for example either when I open the file or when I click on control buttom to run the macro.

My case is:
I have one excel file that has 32 sheets for each personnel, and each sheet has a table of 3 columns (A,B,C) and 26 rows(1-26).
Column A for text
Column B for text also
Column C for Values
my request is to hide/Unhide the entire row/s depending upon the value in column C and for each sheet of the 32 either by pressing a command or by changing in the values or whatever.

Thanks a lot in Advance to all your coopreration

1 response

rizvisa1 Posts 4478 Registration date Thursday January 28, 2010 Status Contributor Last seen May 5, 2022 766
Apr 12, 2010 at 09:31 AM
To filter /hide the rows on all sheet for a given value.

1. The location of the column is same on every sheet
3. Filter needs to be applied on all sheets
3. Sheets are not hidden
4. All Sheets have at least one cell filled

1. Read the assumptions
2. Make a back up copy
3. Press ALT + F11 and insert a new module
4. Paste the code and run it

Sub HideRows()
Dim Sheet As Object
Dim filterFor As Variant
Dim iFilterCol As Integer

    iFilterCol = 3 'apply filter on 3 col
    filterFor = InputBox("Enter the value to be filtered out", "Filter out")
    For Each Sheet In Sheets
        If ActiveSheet.AutoFilterMode Then
        End If
        If ActiveSheet.AutoFilterMode = False Then
        End If
        Selection.AutoFilter Field:=iFilterCol, Criteria1:="<>" & filterFor, Operator:=xlAnd
End Sub
Excellent answer
Jul 10, 2013 at 01:49 PM
Worked perfect......