[RESOLVED] Excel filtering problems galore!!
Hi
I am trying to get an autofilter to sort a datasheet using a combox to set the criteria. is this possible??
I've tried the following:
VB Code:
If Not ComboBox2.Value = "" Then
Selection.AutoFilter field:=2, criteria:=ComboBox2.Value
But I get an error on that one (I've also tried different variations of the above) - is it possible to define a criteria as a user chosen variable? and if not how can i get around it?
Nicolaj
Re: Excel filtering problems galore!!
Try some of these...
u need criteria1....
i tested using a string and it worked fine...
VB Code:
Selection.AutoFilter field:=2, criteria1:=Cstr(ComboBox2.Value)
'Or
Dim tmp as String
tmp = ComboBox2.value
Selection.AutoFilter field:=2, criteria1:=tmp
Re: Excel filtering problems galore!!
Nevermind
I finally solved it myself...
declared the combobox as a string and then put crtieria equal to the string...
Anyways - to those who did, thanx for viewing
Re: Excel filtering problems galore!!
And thanx to you static - You bet me to it!