Macro for hiding rows

byaniess

New Member
Joined
Jun 17, 2010
Messages
23
Is it possible to construct a macro to hid all rows that contain "0" in a select column's cells? (All cells in column B that = 0, hide that row - NOT the column, just the row.) Hopefully this makes sense! Anyway, if this is possible, what would the macro be? I can't write (or even record) a macro to save my life. Any help would be greatly appreciated!
Thank you!!!!
Becky
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Hi Joe4,
Thanks, I tried the macros provided in each of the threads you found, but I don't know how to modify them for my puprose. I'm as dumb as a bag of hammers when it comes to macros. I'll keep tinkering with them, hopefully I stumble upon something. Thanks,
Becky
 
Upvote 0
Here is a quick one that I came up with works:
Code:
Sub MyHideRows()
 
    Dim i As Long
    
    Application.ScreenUpdating = False
    For i = 1 To Cells(Rows.Count, "B").End(xlUp).Row
        If Len(Cells(i, "B")) > 0 And Cells(i, "B") = 0 Then Rows(i).EntireRow.Hidden = True
    Next i
    
    Application.ScreenUpdating = True
        
End Sub
 
Upvote 0
Joe4, as I'm sure you already know, YOU'RE AWESOME! That worked! I can't thank you enough. You're my hero!
Thanks again,
Becky
 
Upvote 0

Forum statistics

Threads
1,216,126
Messages
6,129,008
Members
449,480
Latest member
yesitisasport

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