In excel VBA, I am trying to run a simple autofilter across 50 sheets, however, it only runs it across one sheet. Can anyone help? The code is below:
Sub Macro2()
'
' Macro2 Macro
'
Dim wb As Workbook
For Each wb In Application.Workbooks
Range(Selection, Selection.End(xlToRight)).Select
Selection.AutoFilter
Selection.End(xlToLeft).Select
Range("G1").Select
ActiveSheet.Range("$A$1:$AC$91").AutoFilter Field:=7, Criteria1:=Array("11" _
, "21", "22", "23", "31-33", "42", "44-45", "48-49", "51", "52", "53", "54", "55", "56", "61" _
, "62", "71", "72", "81"), Operator:=xlFilterValues
Selection.End(xlToLeft).Select
Next wb
End Sub
{}
button at the top. It will indent each line with 4 spaces and it will appear as code after submitting the post. – JNevill