S
Scott
I have a worksheet that filtered on a cell that utilized the
validation tool and it worked fine with this code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
If Target.Address = "$B$2" Then
Set r = Me.AutoFilter.Range
r.AutoFilter field:=9, Criteria1:=Range("b2").Value
End If
End Sub
Now I added a combo box called ParentName and linked the cell to the
combo box. the issue I have is the code does not recognize a change in
cell B2. So I changed the code again and I get the range class failed
error.
Private Sub ParentName_Change()
Dim r As Range
Set r = Me.AutoFilter.Range
r.AutoFilter field:=9, Criteria1:=ParentName.Value
End Sub
Can someone see where I went wrong?
validation tool and it worked fine with this code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
If Target.Address = "$B$2" Then
Set r = Me.AutoFilter.Range
r.AutoFilter field:=9, Criteria1:=Range("b2").Value
End If
End Sub
Now I added a combo box called ParentName and linked the cell to the
combo box. the issue I have is the code does not recognize a change in
cell B2. So I changed the code again and I get the range class failed
error.
Private Sub ParentName_Change()
Dim r As Range
Set r = Me.AutoFilter.Range
r.AutoFilter field:=9, Criteria1:=ParentName.Value
End Sub
Can someone see where I went wrong?