Now thta the problem I anticipated. The text for 'Level 1' in the worksheet
must be exactly the same text in the code.
If you've ended up hiding lots of columns you don't want to then this
routine will inhide them
Sub marine()
For x = 1 To Worksheets.Count
Worksheets(x).Columns("F:F").EntireColumn.Hidden = False
Next
End Sub
Paste it in belwo the other code and run it
Mike
"tgcali" wrote:
Thanks! I almost got it. The column is hidden for all the sheets, but it's
not displaying when the value "Level 1" is in cell E2. You've been very
helpful and I really appreciate it.
tgcali
"Mike H" wrote:
Hi,
I've tried to replicate the error but can't so lets try again and a bit
simpler maybe.
It will work as worksheet code so right click the sheet tab of any sheet and
in the pop-up menu click 'View code'.
Paste this in on the right hand side and still in VB editor with the cursor
in the sub tap F5
Sub sonic()
For x = 1 To Worksheets.Count
If Worksheets(x).Range("E2").Value < "Level 1" Then
Worksheets(x).Columns("F:F").EntireColumn.Hidden = True
End If
Next
End Sub
Mike
"tgcali" wrote:
I get the error in the same place for both of them. Any suggestions?
tgcali
"Mike H" wrote:
on reflection try this instead
Sub sonic()
Dim ws As Worksheet
For x = 1 To Worksheets.Count
If Worksheets(x).Range("E2").Value < "Level 1" Then
Worksheets(x).Columns("F:F").EntireColumn.Hidden = True
End If
Next
End Sub
Mike
"tgcali" wrote:
Hello,
I have a workbook with 250 sheets. I need to be able to hide column F unless
cell E2 has the value "Level 1". If there is another value in E2 or it is
blank, I need column F to be hidden. I need this on all 250 sheets. Is this
possible?
Thanks in advance, you are all always to helpful!
tgcali