Chewyhairball
Active Member
- Joined
- Nov 30, 2017
- Messages
- 312
- Office Version
- 365
- Platform
- Windows
Hi Folks
I have this bit of code that i set up ages ago to filter 3 columns in my table based on cell values in B2, B3, B4.
It works perfectly. I have been trying to add another one to B5 to filter field 9 which should be as simple as
copying and pasting then changing the values, however it does not work.
I can ammend one of the origonal 3 and it works but if i add another one to the code it doesnt.
I dont ever remember having to do anything special to cells B2,B3 and B4.
I have been at this for 2 days now trying to figure this out. Tried different sheets, checking cells are not locked......This is driving me nuts.....!
I have this bit of code that i set up ages ago to filter 3 columns in my table based on cell values in B2, B3, B4.
It works perfectly. I have been trying to add another one to B5 to filter field 9 which should be as simple as
copying and pasting then changing the values, however it does not work.
I can ammend one of the origonal 3 and it works but if i add another one to the code it doesnt.
I dont ever remember having to do anything special to cells B2,B3 and B4.
I have been at this for 2 days now trying to figure this out. Tried different sheets, checking cells are not locked......This is driving me nuts.....!
VBA Code:
If target.Address = "$B$2" Then
If Range("B2") = "All Categories" Then
ActiveSheet.Range("table5").AutoFilter Field:=6
Else
Range("table5").AutoFilter Field:=6, Criteria1:=Range("B2")
End If
End If
If target.Address = "$B$3" Then
If Range("B3") = "All Areas" Then
ActiveSheet.Range("table5").AutoFilter Field:=2
Else
Range("table5").AutoFilter Field:=2, Criteria1:=Range("B3")
End If
End If
If target.Address = "$B$4" Then
If Range("B4") = "All Status" Then
ActiveSheet.Range("table5").AutoFilter Field:=40
Else
Range("table5").AutoFilter Field:=40, Criteria1:=Range("B4")
End If
End If