::hide rows if value is 0::

jekstein

New Member
Joined
Aug 31, 2006
Messages
18
currently i have my code checking a specific cell and hiding if that cell = 0

example:
Code:
If Sheets("Total Sheet").Range("a7:a7").Select = 0 Then
    Rows("7").EntireRow.Hidden = True
    End If

I want to have my code check a range of cells and then if any of them = 0 i want it to hide the row its associated with.

Can anyone help me/??

THank you in advance
 
This worked on a text page I setup.
Code:
Sub HideRowBy2Criteria()
Dim rng As Range
Dim LastRow As Long
Dim I As Long

    'finds Row number of last used row in column E
    LastRow = Range("E" & Rows.Count).End(xlUp).Row

    'begin loop to check each row from bottom up
    For I = LastRow To 1 Step -1 ' change 1 to 2 if there's a header row
        Set rng = Range("E" & I)
        If rng.Value = "0" And rng.Offset(, 3).Value = "0" Then
            rng.EntireRow.Hidden = True
        End If
    Next I
End Sub
 
Upvote 0

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top