paulked
06-11-2017, 06:50 AM
Hi there
I am using the code below to hide rows that aren't relevant to a combobox selection.
Private Sub ComboBox1_Change()
Dim lr As Long, x As Integer
lr = Cells(Rows.Count, 1).End(xlUp).Row
ActiveSheet.Cells.EntireRow.Hidden = False
If ComboBox1.Value = "Event" Then GoTo Xit
For x = 5 To lr
If Cells(x, 5).Value <> ComboBox1.Value Then Rows(x & ":" & x).EntireRow.Hidden = True
Next
Xit:
End Sub
The code only works correctly every other time, any idea what I'm doing wrong?
19465
Many thanks
I am using the code below to hide rows that aren't relevant to a combobox selection.
Private Sub ComboBox1_Change()
Dim lr As Long, x As Integer
lr = Cells(Rows.Count, 1).End(xlUp).Row
ActiveSheet.Cells.EntireRow.Hidden = False
If ComboBox1.Value = "Event" Then GoTo Xit
For x = 5 To lr
If Cells(x, 5).Value <> ComboBox1.Value Then Rows(x & ":" & x).EntireRow.Hidden = True
Next
Xit:
End Sub
The code only works correctly every other time, any idea what I'm doing wrong?
19465
Many thanks