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.
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
Any help will be much appreciated.
Thank you,
Matt
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:
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