Hello,
I have recently posted about an issue I had doing this advanced filter. After testing a few things I got it to work. However, it only allows me to filter by one column. I need it to filter by two columns. For example, in the code shown below I put C2 were the data validation box (or list) goes but I can't put another box next to it to further filter the row (if that makes sense?) . Anyways, the real question is: how do you adjust this code to allow for the range to be more than just C2 (by the target address) and then correspondingly change the criteria range to "C1:D2". (I can post the file but I will have to change the information since it is confidential )
Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice 20160606
If Target.Address = Range("C2").Address Then
'if it's "All" then
' put all back
'Else
Range("A4:L73").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("C1:C2"), CopyToRange:=Range("A77:L77")
Debug.Print "foo"
'End If
End If
End Sub
I have recently posted about an issue I had doing this advanced filter. After testing a few things I got it to work. However, it only allows me to filter by one column. I need it to filter by two columns. For example, in the code shown below I put C2 were the data validation box (or list) goes but I can't put another box next to it to further filter the row (if that makes sense?) . Anyways, the real question is: how do you adjust this code to allow for the range to be more than just C2 (by the target address) and then correspondingly change the criteria range to "C1:D2". (I can post the file but I will have to change the information since it is confidential )
Private Sub Worksheet_Change(ByVal Target As Range)
'Updateby Extendoffice 20160606
If Target.Address = Range("C2").Address Then
'if it's "All" then
' put all back
'Else
Range("A4:L73").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, CriteriaRange:=Range("C1:C2"), CopyToRange:=Range("A77:L77")
Debug.Print "foo"
'End If
End If
End Sub