×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

EXCEL USING AUTOFILTER with VBA PROBLEM!!

EXCEL USING AUTOFILTER with VBA PROBLEM!!

EXCEL USING AUTOFILTER with VBA PROBLEM!!

(OP)
HI

IT'S POSSIBLE TO COPY the FIELDS of an EXCEL AUTOFILTER (the dropdown list) in a combobox list??ponderneutralneutral


I want to choose the field to apply to a column using a combobox of a userform:



Selection.AutoFilter field:=3,Criteria1:=Me.ComboBox1.Value

There is a way to have Combox1 list the same as filter fields list?

thumbsup2peace
LET ME KNOW

RE: EXCEL USING AUTOFILTER with VBA PROBLEM!!

You could put everything into a collection, sort the collection and then put the items of the collection into the combobox. For example:

CODE

    Me.ComboBox1.Clear
    'fill the collection from worksheet w, cells A2, A3, ...
    i = 2
    On Error Resume Next
    Do While w.Cells(i, 1).Value <> ""
        c.Add w.Cells(i, 1).Value, CStr(w.Cells(i, 1).Value)
        i = i + 1
    Loop
    'Sort the collection, if you want.
    'Insert your favorit routine here.
    
    'Add the items of the collection into the combobox
    For Each p In c
        Me.ComboBox1.AddItem p
    Next p

Cheers,
Joerd

Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources