VBA Macro for filtering on multiple set criteria

drewberts

Board Regular
Joined
Sep 5, 2013
Messages
177
Office Version
  1. 365
Platform
  1. Windows
I'm using the code below which is assigned to a button to filter based on a list of criteria. I'm getting an error when running and I can't see my problem:-

Code:
Public Sub cmdLiveJobs_Click()
    ActiveSheet.ListObjects(1).AutoFilter.ShowAllData
    Application.ScreenUpdating = False
    
        Range("E8:E10000").CurrentRegion.AutoFilter _
        Field:=5, Criteria1:=Array("JOB RAISED", "PROGRAMMED", "FIELD", "OFFICE", "DELIVERED", "INVOICED"), Operator:=xlFilterValues
    
    ActiveWindow.ScrollRow = 1
    Application.ScreenUpdating = True
    Calculate
End Sub

Can anyone point out the obvious error (assuming its obvious, because I cant see it)? :)
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Hi drewberts,

Nope, it's not that obvious :) I tried to run your code on a small subset of data and it works perfectly fine. Would be helpful if you could describe what kind of error message you are receiving and maybe even share your file.
 
Upvote 0
Thanks for the reply

The data is fairly sensitive so I can't share it but the following is the error I get

008.jpg


007.jpg
 
Upvote 0
Thanks drewberts.

One more request - could you please go to VBA, Immediate Window (Ctrl+G), paste the following code:
?ActiveSheet.ListObjects(1).Range.Address

And then hit Enter and let me know the results?
 
Upvote 0

Forum statistics

Threads
1,224,818
Messages
6,181,152
Members
453,021
Latest member
Justyna P

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