View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Steve[_74_] Steve[_74_] is offline
external usenet poster
 
Posts: 39
Default Hiding/Unhiding sheets and rows (An easy one for most of you....)

This hide's a sheet if OK is pressed:

Sub HideSheet()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Worksheets("Sheet1").Visible = False
Else
Worksheets("Sheet1").Visible = True
End If
End Sub



This does the same with Column C

Sub HideCol()
Dim hideit
hideit = MsgBox("Press OK to hide", vbOKCancel, "Hide Test")

If hideit = 1 Then
Columns("C:C").EntireColumn.Hidden = True
Else
Columns("C:C").EntireColumn.Hidden = False
End If

End Sub

HTH
Steve




"Dean Goodmen" wrote in message
...
I have three sheets in my workbook and under certain circumstance I
need to hide/unhide and entire sheet, or just certain rows. Could some
one give me an example on how to code a line to do this?

Thanks!