A few words of thanks would be greatly appreciated.

Excel - Hide rows with zero value in Multiple sheets


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 bottom 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.


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


Thanks to rizvisa1 for this tip on the forum.


A few words of thanks would be greatly appreciated.

Ask a question
CCM is a leading international tech website. Our content is written in collaboration with IT experts, under the direction of Jean-François Pillou, founder of CCM.net. CCM reaches more than 50 million unique visitors per month and is available in 11 languages.
This document, titled « Excel - Hide rows with zero value in Multiple sheets », is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!