View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vacation's Over Vacation's Over is offline
external usenet poster
 
Posts: 279
Default newbie help - code need correcting

if sheet number no quotes, if you name sheets on the tab then use quotes

Sub Macro1()
With activeworkbook
If .sheets(2).Visible = True Then
.sheets(2).Visible = False
else
.sheets(2).visible = True
end if

If .sheets(3).Visible = True Then
.sheets(3).Visible = False
else
.sheets(3).visible = True
end if
end With

End Sub

"haitch2" wrote:


Hi

Im very inexperiance with VBA so please be gental Im trying
to learn

right i have a small bit of code conected to a macro to hide/show
worksheets when a check box is toggled.

Sub Macro1()

If Worksheets("2").Visible = True Then
Worksheets("2").Visible = False
If Worksheets("3").Visible = True Then
Worksheets("3").Visible = False
Else
Worksheets("2").Visible = True
Worksheets("3").Visible = True
End If

End Sub

It hides the sheets but i cant get them to reapear again.

i can get it to work for one sheet but not 2.

Thanks for any help


--
haitch2
------------------------------------------------------------------------
haitch2's Profile: http://www.excelforum.com/member.php...o&userid=27677
View this thread: http://www.excelforum.com/showthread...hreadid=474940