![]() |
VB and Advanced Filter
Hi -
Is there a way to state a criteron range in an advanced filter? I cannot figure out the syntax if there is. Please see below on the filter as I have placed a "Range" in the filter that obviously doesn't work but is there a way to make it work? Thanks Carrie Private Sub ListBox1_Click() Dim UserInput As Range Dim UserInput2 As Range Set UserInput = Worksheets("Keys").Range("K9") Set UserInput2 = Worksheets("Keys").Range("K10") Range("UserInput") = ListBox1.Value For i = 1 To ListBox1.ListCount - 1 Range("UserInput2") = ListBox1.Selected(i) Next Sheets("Classes").Select Selection.AutoFilter Field:=6, Criteria1:="Range.UserInput", Operator: =xlAnd -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200802/1 |
VB and Advanced Filter
Private Sub ListBox1_Click()
Dim UserInput As Range Dim UserInput2 As Range Set UserInput = Worksheets("Keys").Range("K9") Set UserInput2 = Worksheets("Keys").Range("K10") UserInput.Value = ListBox1.Value For i = 1 To ListBox1.ListCount - 1 Range("UserInput2") = ListBox1.Selected(i) Next Sheets("Classes").Select Selection.AutoFilter Field:=6, Criteria1:=UserInput, Operator:=xlAnd -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Carrie_Loos via OfficeKB.com" <u34134@uwe wrote in message news:7fd9108ec5376@uwe... Hi - Is there a way to state a criteron range in an advanced filter? I cannot figure out the syntax if there is. Please see below on the filter as I have placed a "Range" in the filter that obviously doesn't work but is there a way to make it work? Thanks Carrie Private Sub ListBox1_Click() Dim UserInput As Range Dim UserInput2 As Range Set UserInput = Worksheets("Keys").Range("K9") Set UserInput2 = Worksheets("Keys").Range("K10") Range("UserInput") = ListBox1.Value For i = 1 To ListBox1.ListCount - 1 Range("UserInput2") = ListBox1.Selected(i) Next Sheets("Classes").Select Selection.AutoFilter Field:=6, Criteria1:="Range.UserInput", Operator: =xlAnd -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...excel/200802/1 |
VB and Advanced Filter
Oh my gosh - Do I feel silly! I thought I had already tried thatThanks for
your help. Bob Phillips wrote: Private Sub ListBox1_Click()! Dim UserInput As Range Dim UserInput2 As Range Set UserInput = Worksheets("Keys").Range("K9") Set UserInput2 = Worksheets("Keys").Range("K10") UserInput.Value = ListBox1.Value For i = 1 To ListBox1.ListCount - 1 Range("UserInput2") = ListBox1.Selected(i) Next Sheets("Classes").Select Selection.AutoFilter Field:=6, Criteria1:=UserInput, Operator:=xlAnd Hi - [quoted text clipped - 24 lines] Selection.AutoFilter Field:=6, Criteria1:="Range.UserInput", Operator: =xlAnd -- Message posted via http://www.officekb.com |
All times are GMT +1. The time now is 10:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com