Data Filter from Criteria Supplied from Listboxes on a Userform

Metserv

New Member
Joined
Nov 16, 2012
Messages
7
Greetings

I am new on this forum and learning excel vba programming. I currently want to be able to filter a large amount of data based on a criteria supplied into a separate range from a userform with multiple
list boxes. I have managed the form and the listboxes, i just want to be able to able to filter the data range based on criteria on a serapare criteria range, and have the filtered list in place ( or in a separate sheet).

Below is an illustration of the data ( Not exactly the client data, due to confidentiality).

Data source Range (sheet name "data")
A B C
Attribute Branch Region
1 A X East
2 A Y West
3 A Y East
4 A Y Central
5 B X East
6 B X South
7 B Y East

Criteria Range ( supplied from a userform) (Sheet Name "Criteria")
J K L
1 A X East
2 A X West
3 C Y Central
4
5

The data range is very large( about 3000 rows). I want it to be flexible to allow filtering the data even if for instance, a region or a branch is not specified. I have tried advanced filters, loops e.t.c but without any success.
Any help will be appreciated.

Thank you !
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Hi and Welcome to the Board,

Using Advanced Filter through VBA would seem to be a good fit for your application.

What problem did you have when you tried to implement that?

I'd suggest that you first get this to work manually using AdvancedFilter, then once you have the hang of it use the macro recorder to get the syntax. You'll need a final step to make the code dynamic instead of having it reference fixed ranges.

It's easier to filter in place- so best to get that working before trying the CopyTo option.
Lastly, be aware that AdvanceFilter treats criteria in the same row as "AND" criteria (Attribute A AND Branch X AND Region East); wherea criteria on separate rows is treated as "OR" criteria.
 
Upvote 0

Forum statistics

Threads
1,215,341
Messages
6,124,391
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top