programsam
Board Regular
- Joined
- Feb 10, 2016
- Messages
- 123
Greetings, I think the subject says it all but I'm having a difficult time getting this For Next loop to run through the entire range to hide all of the rows that meet a specific value.
Please advise Code below
Please advise Code below
VBA Code:
Private Sub Worksheet_calculate()
Dim c As Range
Dim divSelection As String
'Set c = Me.Range("CG16")
divSelection = ActiveSheet.Range("CG16").Value
Application.ScreenUpdating = False
For Each c In Range("A19:A75") 'Cells(Rows.Count, "A").End(xlUp))
If c.Value <> divSelection Then
c.EntireRow.Hidden = True
Else
c.EntireRow.Hidden = False
End If
Next c
Application.ScreenUpdating = True
End Sub