VBA filtering by multiple criteria shows error 1004

nickamongo

New Member
Joined
May 15, 2018
Messages
6
So I keep getting an error 1004 on this line when I want to filter a drop-down set from cell C4 - any ideas why?




Sub Update()


ActiveWorkbook.RefreshAll
Columns("L:L").EntireColumn.AutoFit
Selection.EntireColumn.Hidden = False
ActiveSheet.Range("$L$4").AutoFilter Field:=1, Criteria1:="FALSE"
ActiveSheet.Range("$C$4").AutoFilter Field:=1, Criteria1:=Array("1. Open", "2. Managed", "In Progress", "Not Started", "Status"), Operator:=xlFilterValues

End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
So I keep getting an error 1004 on this line when I want to filter a drop-down set from cell C4 - any ideas why?

Sub Update()

ActiveWorkbook.RefreshAll
Columns("L:L").EntireColumn.AutoFit
Selection.EntireColumn.Hidden = False
ActiveSheet.Range("$L$4").AutoFilter Field:=1, Criteria1:="FALSE"
ActiveSheet.Range("$C$4").AutoFilter Field:=1, Criteria1:=Array("1. Open", "2. Managed", "In Progress", "Not Started", "Status"), Operator:=xlFilterValues

End Sub

I tried the code and I have no error.
Where do you have the data in C or in A?
You can put a sample of how your data is in the cells.
 
Upvote 0
[B said:
ActiveSheet.Range("$C$4").AutoFilter Field:=1, Criteria1:=Array("1. Open", "2. Managed", "In Progress", "Not Started", "Status"), Operator:=xlFilterValues[/B][/U]

Data is in Column C. I tried canging the field to 3 but that hasn't changed anything.
 
Upvote 0
You could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.
 
Upvote 0
You could upload a copy of your file to a free site such as www.box.com or www.dropbox.com. Once you do that, mark it for 'Sharing' and you will be given a link to the file that you can post here. If the workbook contains confidential information, you could replace it with generic data.

https://www.dropbox.com/s/fvuwnvpwihe3xe2/Example VBA.xlsm?dl=0

Now it seems to be failing at the name? (as I'm typing this I think there may be a space in the macro title though...)
 
Upvote 0
Apparently you can not filter with VBA when you have data from a pivot table in the same selection.


You will have to copy all the data to another sheet and make the filters with the information on the other sheet.
 
Upvote 0

Forum statistics

Threads
1,223,904
Messages
6,175,295
Members
452,633
Latest member
DougMo

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