PDA

View Full Version : [SOLVED] Hide/Unhide Worksheet



rama4672
06-04-2004, 03:02 PM
I have done a sheet within a workbook named instructions it explains to the user how to use the programme, I have hidden the sheet, when the user clicks on a control button it un hides the sheet and displays the sheet, and there is another button on the sheet to take you back to the menu which hides the sheet again and puts you back at the menu.
Now to my question if the user clickes on the button fo instructiions it will unhide the sheet and show it, but if they then click on another tab instead of the button to take you back to the menu the sheet is still displayed, how do i get it to hide the sheet when ever you click on any other tab.
here is the code i have got.



Private Sub CommandButton4_Click()
Sheets("instructions").Visible = True
Sheets("instructions").Select
End Sub

Private Sub CommandButton1_Click()
Sheets("instructions").Visible = False
Sheets("menu").Select
End Sub


ps where are the vb tags, I can't find any

Regards

Ian

Zack Barresse
06-04-2004, 03:08 PM
In the worksheet tab, Right click (instructions) -> View Code, paste this in there:


Private Sub Worksheet_Deactivate()
Sheets("instructions").Visible = False
End Sub


Help any?

rama4672
06-04-2004, 03:13 PM
brilliant, thanks so much firefytr, I can't believe how fast you were in responding.

Regards

Ian