How can you change autofilter with VBA?

VTTW

New Member
Joined
Mar 24, 2002
Messages
26
can you change the filter criteria of a worksheet based on the value of a combobox on a userform?

Example:
I have a worksheet that has two columns of data. In column A, I have three different entries, completed, pending, & paused. In column B, I have just misc tasks. I have filtered the worksheet based on column A. Is there a way that when select one of the three column A criteria in combobox1 on my userform only the data that matches that criteria in column B displays in listbox1??
This message was edited by VTTW on 2002-03-25 19:33
 

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,

You can try the following line of code:

Selection.AutoFilter Field:=14, Criteria1:=Sheets("Sheet1").combobox1.value

HTH
 
Upvote 0
Just a note,

"Field" is the column number of your selection.

"Criteria" is the custom filter criteria.

HTH
 
Upvote 0

Forum statistics

Threads
1,213,557
Messages
6,114,293
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