Hello, can I ask for some help - the below code only works on one worksheet but it doesn't loop, and I think it might have to do with not qualifying the ranges. I attempted to add in With ws and End with, but I came up with all kinds of errors. Could you please help update the code?
VBA Code:
Sub Refresh()
Dim CurrentMonth As String
CurrentMonth = Sheets("Filters").Range("G6")
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
If ws.Name Like "A" Or ws.Name Like "B" Or ws.Name Like "C" Or ws.Name Like "D" Then
Columns("L:BL").Select
Selection.Columns.Ungroup
Columns("L:BL").Select
Selection.EntireColumn.Hidden = False
Set Cell = Cells.Find(CurrentMonth, , xlValues, xlWhole, , , False)
If Not Cell Is Nothing Then
ColLetter = Chr(Asc(Split(Cell.Address, "$")(1)) + 3)
End If
'MsgBox (ColLetter)
Columns(ColLetter & ":BK").Select
Selection.Columns.Group
Range("BL1").Select
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
'ActiveWorkbook.RefreshAll
End If
Next ws
End Sub