Filter multiple sheets.

DanWatson

New Member
Joined
May 10, 2018
Messages
2
I'm using this code to filter data based on a cell value:

With Sheets("A1")

.Range("A18:AM47").AutoFilter Field:=11, Criteria1:=.Range("K12").Value

End With

End Sub

I would like to run this on multiple sheets A1 through A15. Any help would be appreciated.
Thanks from a VBA novice.
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Code:
[COLOR=#333333]For i = 1 to 15

With Sheets("A" & i)[/COLOR]

[COLOR=#333333].Range("A18:AM47").AutoFilter Field:=11, Criteria1:=.Range("K12").Value[/COLOR]

[COLOR=#333333]End With

[/COLOR]Next i

End Sub
 
Upvote 0
Thank you Chameleon64 - that's perfect!
Dan

For i = 1 to 15

With Sheets("A" & i)


.Range("A18:AM47").AutoFilter Field:=11, Criteria1:=.Range("K12").Value

End With

Next i[/CODE]

End Sub[/QUOTE]
 
Upvote 0

Forum statistics

Threads
1,213,543
Messages
6,114,243
Members
448,555
Latest member
RobertJones1986

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