Results 1 to 4 of 4

Thread: [RESOLVED] Excel filtering problems galore!!

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    96

    Resolved [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:
    1. If Not ComboBox2.Value = "" Then
    2. 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

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Excel filtering problems galore!!

    Try some of these...
    u need criteria1....
    i tested using a string and it worked fine...
    VB Code:
    1. Selection.AutoFilter field:=2, criteria1:=Cstr(ComboBox2.Value)
    2. 'Or
    3. Dim tmp as String
    4. tmp = ComboBox2.value
    5. 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"

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    96

    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

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    96

    Resolved 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
  •  



Click Here to Expand Forum to Full Width