Hi All,
I'd be grateful of any help in getting a looped command working across multiple sheets.
I think I'm close to getting this, but when I run the below it only performs the column hides on the last associated worksheet - it isn't applied to all worksheets (ignoring those excluded).
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
With ws
LastColumn = 100
'Ignore the following worksheets
For j = 1 To LastColumn
If Cells(11, j) = 0 And Cells(11, j) <> "" Then Columns(j).EntireColumn.Hidden = True
Next j
For k = 1 To LastColumn
If Cells(11, k) = 0 And Cells(11, k) <> "" Then Columns(k + 1).EntireColumn.Hidden = True
Next k
End If
End With
Next ws
Thanks so much for any help,
Best Regards,
Shabangle
I'd be grateful of any help in getting a looped command working across multiple sheets.
I think I'm close to getting this, but when I run the below it only performs the column hides on the last associated worksheet - it isn't applied to all worksheets (ignoring those excluded).
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
With ws
LastColumn = 100
'Ignore the following worksheets
If (ws.Name <> "Notes") And (ws.Name <> "Home") And (ws.Name <> "Stage0A_SO") And (ws.Name <> "Stage0A_PO") And (ws.Name <> "Stage0A_FS") And (ws.Name <> "Stage0B_IO") And (ws.Name <> "Stage1A_T") And (ws.Name <> "Stage1A_M") And (ws.Name <> "Stage1B_S") And (ws.Name <> "Stage1C_SC") And (ws.Name <> "Stage1D_RE") And (ws.Name <> "Stage2A_WE") Then
For j = 1 To LastColumn
If Cells(11, j) = 0 And Cells(11, j) <> "" Then Columns(j).EntireColumn.Hidden = True
Next j
For k = 1 To LastColumn
If Cells(11, k) = 0 And Cells(11, k) <> "" Then Columns(k + 1).EntireColumn.Hidden = True
Next k
End If
End With
Next ws
Thanks so much for any help,
Best Regards,
Shabangle