Hi, I am a VBA beginner, trying to figure out how to hide rows based on the value of a cell. I have seen similar posts that did not quite answer what I am trying to do.
If cell A3 = "Brand", I want to hide all rows where C9:C2000 NOT= "Brand"
Else if cell A3 = "Other", I want to hide all rows where C9:C2000 NOT= "Other"
Else if cell A3 = "All", don't hide any rows
This is what I tried... what am I doing wrong?
Sub hiderows2()
For Each d In Range("C9:C2000")
If Range("A3").Value = "Brand" Then Rows(d.Row).Hidden = True
Else: If Range("A3").Value = "Other" Then Rows(d.Row).Hidden = True
Else: Rows(d.Row).Hidden = False
Next
End Sub
Thank you!
If cell A3 = "Brand", I want to hide all rows where C9:C2000 NOT= "Brand"
Else if cell A3 = "Other", I want to hide all rows where C9:C2000 NOT= "Other"
Else if cell A3 = "All", don't hide any rows
This is what I tried... what am I doing wrong?
Sub hiderows2()
For Each d In Range("C9:C2000")
If Range("A3").Value = "Brand" Then Rows(d.Row).Hidden = True
Else: If Range("A3").Value = "Other" Then Rows(d.Row).Hidden = True
Else: Rows(d.Row).Hidden = False
Next
End Sub
Thank you!