First let me say I am new to VBA and I found your website and it has been very helpful!
I have been scowering the web and can't get a clear answer...
Can a combobox be linked to an autofilter? Essentially the combobox would do the exact same thing as the autofilter?
PREFACE:
I am building a report generator with a UserForm.
I have a Userform with 4 Comboboxes. The first is a NAME, 2nd is month, 3rd is a company, and 4th is product number. This data will be drilled down(filtered) using the the comboboxes/autofilter.
Workbook:
Sheet - RawData where data is located. The table has entries that correspond to the 4 comboboxes, but also has other columns for quantity, price etc. A total of 90 columns data that has multiple similar entries / repeat data.
Sheet - CopyData - Sheet where data that has been Autofiltered/Drilled down will be copied to in order for reports to be generated.
Hi lnk2013
Welcome to the Forum!
Sure, you can use the ComboBox entries to filter data. Without seeing your actual worksheet I can only give you the concept. The code to do the filtering would look something like thisChange the underlined/bold items to suit.ActiveSheet.Range("Your Range").AutoFilter Field:=3, Criteria1:=Me.ComboBox1.Value ActiveSheet.Range("Your Range").AutoFilter Field:=5, Criteria1:=Me.ComboBox2.Value ActiveSheet.Range("Your Range").AutoFilter Field:=7, Criteria1:=Me.ComboBox3.Value ActiveSheet.Range("Your Range").AutoFilter Field:=9, Criteria1:=Me.ComboBox4.Value
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please click EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks