Autofilter in Userform2.Spreadsheet1

m0atz

Board Regular
Joined
Jul 17, 2008
Messages
247
Afternoon all,

I'm having some trouble with the code to autofilter the results in spreadsheet1 that i've added in to a userform (userform2).

I have columns A - F showing with all rows, which works fine.

I have been able to enable the autofilter, as follows:

With Spreadsheet1
rngTarget.Value = rngSource.Value
.Columns("A:Z").EntireColumn.AutoFit
.Columns("D:D").NumberFormat = "0"
.Columns("A:F").AutoFilter
End With

The autofilter property however appears different to that of a 'normal worksheet'. What i want is for the autofilter to filter the result for the value of userform1.combobox1.value

is this possible?

I've tried the following:

.columns("A:F").AutoFilter, field:=1, criteria1:= userform1.combobox1.value

but i get a weird message when i run the userform, saying that Field 1 and Criteria 1 must be omitted or equal to " " which doesnt work for me...

Any clues??

Much appreciated.

colin
 
In the Properties window, there's a Custom option at the top. When you click on that, you should see a button with an ellipsis (...) on it. Click that, then switch to the Workbook tab. In code it's:
Code:
Spreadsheet1.Activewindow.displayworkbooktabs = false
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,216,077
Messages
6,128,685
Members
449,463
Latest member
Jojomen56

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