I want to hide columns in multiple worksheets using this code:
Sheet3.Select
Dim rng As Range
Dim c As Range
Set rng = Range("E12:BR12")
For Each c In rng
If c.Value = 1 Then
c.EntireColumn.Hidden = False
Else
c.EntireColumn.Hidden = True
End If
Next c
How do I run this for multiple worksheets without repeating the code? I tried to use an array.....:
Worksheets(Array(3, 47, 48)).Select
.....but kept getting an error (run-time error '1004": Select method of Sheets class failed)
How do I cycle through all of the worksheets?
Sheet3.Select
Dim rng As Range
Dim c As Range
Set rng = Range("E12:BR12")
For Each c In rng
If c.Value = 1 Then
c.EntireColumn.Hidden = False
Else
c.EntireColumn.Hidden = True
End If
Next c
How do I run this for multiple worksheets without repeating the code? I tried to use an array.....:
Worksheets(Array(3, 47, 48)).Select
.....but kept getting an error (run-time error '1004": Select method of Sheets class failed)
How do I cycle through all of the worksheets?