Consulting

Results 1 to 3 of 3

Thread: Hide/Unhide Worksheet

  1. #1
    VBAX Regular
    Joined
    May 2004
    Location
    UK
    Posts
    71
    Location

    Hide/Unhide Worksheet

    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

  2. #2
    Site Admin
    Urban Myth
    VBAX Guru
    Joined
    May 2004
    Location
    Oregon, United States
    Posts
    4,940
    Location
    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?

  3. #3
    VBAX Regular
    Joined
    May 2004
    Location
    UK
    Posts
    71
    Location
    brilliant, thanks so much firefytr, I can't believe how fast you were in responding.

    Regards

    Ian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •