Filtering/Screening Data using Userform

madrid1234

New Member
Joined
Aug 7, 2014
Messages
2
Hi all,

I have a range of cross-sectional data, with a couple hundred rows and 10 or so columns. I would like to create a screener that filters this data according to criteria that are entered in a userform.

For example, I would like to filter the raw data for all entries that have a Column C entry between 10 and 30, and Column F entries between 1 and 5.

I already created a userform with the relevant drop-down boxes / textboxes. Any ideas on writing the VBA code to do the filtering?

I am attempting to record a macro in which I simply use the advanced filter manually, but I don't know how I would adjust the code so that the program filters according to any ranges the user specifies in the userform.

Thanks!
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Hi Madrid,

With regards to your problem, bear in mind the userform is only a user interface ...
As far as writing the VBA code, why don't you turn on the macro recorder and go through the process once ...
You will get the backbone of the VBA code ...

HTH
 
Upvote 0
Thanks for your response James. The problem is that I don't know how to make the filtering dependent on the variables you enter in the userform. For example, let's say my data represents various cities around the world (rows) and their characteristics (columns), and let's assume I want to filter for all cities with average temperature between 10 and 20 degrees. If I record the process, I will have to pick some numbers for the temperature I want to filter. But eventually, I want the program to filter for cities with temperatures between any variables x and y that the user enters into the userform.
 
Upvote 0
Hi,

The process you are describing is the exact one ...
Just go ahead with the macro recorder ... and you will get your code written ...
Then, you will have to slightly adjust it, say for the temperatures by creating the variables the user will input ...
But all the "hard" work will already be done ...

HTH
 
Upvote 0

Forum statistics

Threads
1,213,559
Messages
6,114,302
Members
448,564
Latest member
ED38

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