VBA Code to control autofilter???

datastream

New Member
Joined
Apr 17, 2002
Messages
14
I need VBA code to control auto filter criteria and operators.

For example, if a user selects vehicles > $20,000 in a userform, the filter will automatically set the autofilter on the data in the worksheet to "greater than" and "20,000" for the value and display only those in the worksheet over 20,000. I know how to use autofilter, but the user will only be entering values in user forms and i need it to control the autofilter on a sheet.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
'this works

Dim Class As String
Class = ClassBox.Text
Worksheets("DATA").Range("A1:AE945").Select
Selection.AutoFilter Field:=1, Criteria1:=Class

'This turns on the filter in a sheet named "DATA" on column A, it then enters the critera "Class" which is a string of a selection form a listbox on a userform. Whatever the user selects, becomes the criteria for the filter on column A.
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,150
Members
448,552
Latest member
WORKINGWITHNOLEADER

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