Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 3 of 3

Thread: How can you change autofilter with VBA?

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    can you change the filter criteria of a worksheet based on the value of a combobox on a userform?

    Example:
    I have a worksheet that has two columns of data. In column A, I have three different entries, completed, pending, & paused. In column B, I have just misc tasks. I have filtered the worksheet based on column A. Is there a way that when select one of the three column A criteria in combobox1 on my userform only the data that matches that criteria in column B displays in listbox1??

    [ This Message was edited by: VTTW on 2002-03-25 19:33 ]

  2. #2
    Board Regular
    Join Date
    Mar 2002
    Location
    Wellington
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    You can try the following line of code:

    Selection.AutoFilter Field:=14, Criteria1:=Sheets("Sheet1").combobox1.value

    HTH

  3. #3
    Board Regular
    Join Date
    Mar 2002
    Location
    Wellington
    Posts
    115
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Just a note,

    "Field" is the column number of your selection.

    "Criteria" is the custom filter criteria.

    HTH

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •