|
-
Jun 19th, 2006, 03:28 AM
#1
Thread Starter
Lively Member
[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
-
Jun 19th, 2006, 08:15 AM
#2
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
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jun 19th, 2006, 08:17 AM
#3
Thread Starter
Lively Member
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
-
Jun 19th, 2006, 08:18 AM
#4
Thread Starter
Lively Member
Re: Excel filtering problems galore!!
And thanx to you static - You bet me to it!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|