Filtering Data for specific #'s - Code works in VBA screen but not using a "button"

MatthewLane412

New Member
Joined
Aug 23, 2017
Messages
24
Hello,

I have a spreadsheet that I need to filer for a specific set of #'s each time. The code works great when I run the Macro from the VBA Screen, but I am unable to get it to work using a button in excel. It skips over this portion of the coding for some reason.


Code:
Set rng = Sheet2.Range ("A1:J10000")
FilterField = WorksheetFunction.Match ("Prop Type", rng.Rows (1), 0)

If ActiveSheet.AutoFilterMode = False Then rng.AutoFilter

rng.AutoFilter Field:=FilterField, Criteil:=Array( _
"582", "588", "603","650"), Operator:=xlfiltervalues
Code:



Any help will be much appreciated.



Thank you,
Matt
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.
Hi Matt,

Perhaps this part of the code is incorrect:-

Criteil:=

Should it read as Criteria1:=.....?

Cheerio,
vcoolio.
 
Upvote 0

Forum statistics

Threads
1,214,643
Messages
6,120,702
Members
448,980
Latest member
CarlosWin

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