Macro to hide rows

eagerexcel

New Member
Joined
Apr 17, 2012
Messages
3
I have created a workbook that I need a macro for
In sheet one I have inserted a "push button" that I'm assigning a macro to in sheet 3

All calculations and fields are already completed at this point. What I need is the system to jump to sheet 3 and hide all the rows that have a "No" value in column S

To explain more:
The columns A - R has information in it.
The deciding cell is the cell in column S. If the cell has a "No" in it I want the entire row to be hidden.

I have tried to figure it out by playing but have come up short

Please help
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Try

Code:
Sub atest()
Dim LR As Long, i As Long
Application.ScreenUpdating = False
With Sheets("Sheet3")
    LR = .Range("S" & Rows.Count).End(xlUp).Row
    For i = 1 To LR
        .Rows(i).Hidden = .Range("S" & i).Value = "No"
    Next i
End With
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Something like

Code:
Dim lst As Long, i As Long
With Sheet3
    lst = .Range("S" & Rows.Count).End(xlUp).Row
    For i = lst To 2 Step -1
        With .Range("S" & i)
            .EntireRow.Hidden = .Value = "No"
        End With
    Next i
End With
 
Upvote 0

Forum statistics

Threads
1,216,759
Messages
6,132,556
Members
449,735
Latest member
Gary_M

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