cedricthecat
Active Member
- Joined
- May 17, 2007
- Messages
- 460
Hi folks
I have this macro, which works fine when set to hide Worksheets (hides all sheets except "Overview")
However, I am trying to adapt this to hide Columns in all sheets except "Overview" (as below) but instead it only hides the specified Columns in "Overview"!! Can someone tell me what I am doing wrong?!
I have this macro, which works fine when set to hide Worksheets (hides all sheets except "Overview")
Code:
Sub HideSheets()
Dim wsSheet As Worksheet
For Each wsSheet In Worksheets
If wsSheet.Name <> "Overview" Then
wsSheet.Visible = False
End If
Next wsSheet
End Sub
However, I am trying to adapt this to hide Columns in all sheets except "Overview" (as below) but instead it only hides the specified Columns in "Overview"!! Can someone tell me what I am doing wrong?!
Code:
Sub HideColumns()
Dim wsSheet As Worksheet
For Each wsSheet In Worksheets
If wsSheet.Name <> "Overview" Then
Columns("A:M").Select
Selection.EntireColumn.Hidden = True
End If
Next wsSheet
End Sub