Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofilter method of range class failed
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? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofilter method of range class failed
I received an answer in a different post.
On Jul 22, 9:44*am, Scott wrote: 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? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Autofilter method of range class failed
Any chance of posting what the solution was?
-- Many thanks, Gary Varga "Scott" wrote: I received an answer in a different post. On Jul 22, 9:44 am, Scott wrote: 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? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
PasteSpecial method of Range class failed | Excel Programming | |||
AutoFilter method of Range class failed | Excel Programming | |||
AutoFilter method of Range class failed | Excel Programming | |||
Autofilter method of range class failed | Excel Programming | |||
AutoFilter method of Range Class Failed | Excel Programming |