I have seen several pieces of code like below on how to do this but none fits exactly what I want to do.
What I want to achieve is when I change Cell G4 it will then hide any rows where Column B has a 1 in it between rows 16 and 76.
What I want to achieve is when I change Cell G4 it will then hide any rows where Column B has a 1 in it between rows 16 and 76.
VBA Code:
Sub Test_Hide_Ones()
Application.ScreenUpdating = False
Dim i As Integer
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To Lastrow
If Cells(i, 1).Value = 1 Then Rows(i).Hidden = True
Next
Application.ScreenUpdating = True
End Sub