I am trying to get this macro to loop through all sheets within a workbook & then filter & clear some cells.. the loop works when I do not have the filter/clear cells part of the macro enabled however as soon as I uncomment the filter & clear part of the macro, the macro will only filter and clear the cells within the Active Sheet, any ideas where I am going wrong?
Any help very much appreciated!
Sub MovethroughWB()
Dim ws As Worksheet
For Each ws In Sheets 'This statement starts the loop
If ws.Name <> "Exclusions" Then 'Exclude this sheet from the loop
Range("D2:J2").Select
Selection.AutoFilter
ActiveSheet.Range("$D$2:$J$200").AutoFilter Field:=7, Criteria1:="<>#N/A", _
Operator:=xlAnd
Range("D3:J200").Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.ClearContents
End If
Next ws
End Sub