none
vba code to hide other sheets except login sheet with userform RRS feed

  • Question

  • Hi. I am working on a tracker and I want all other sheets to be hidden except for the login page. please help. thanks!
    Monday, December 19, 2011 5:27 PM

Answers

  • Hello,

    Try this:

    Sub ShowLoginSheet()
        Dim sh As Worksheet
        For Each sh In Application.Worksheets
              If sh.Name = "Login" Then
                  sh.Visible = True
              Else
                 sh.Visible = False
              End If
        Next
    End Sub

     

    Nadia

    • Proposed as answer by koshie_me Tuesday, December 20, 2011 3:06 AM
    • Marked as answer by danishaniModerator Wednesday, January 11, 2012 8:41 PM
    Tuesday, December 20, 2011 1:46 AM

All replies

  • Hi Team,

    I am currently working on a tracker and would like only to show the login page or welcome page when the tracker is activated. I added the following codes but it's working only when the Enable macros is selected. I want my tracker to show the login page instantly when the spreadsheet is opened.

     

    Private Sub Workbook_Activate()
       
        shLOGIN.Visible = xlSheetVisible
        shTRACKER.Visible = xlSheetVeryHidden
        shOUTBOUND.Visible = xlSheetVeryHidden
        shCALENDARWEEK.Visible = xlSheetVeryHidden
        shDATABASE.Visible = xlSheetVeryHidden
        shCMR.Visible = xlSheetVeryHidden
        shUPDATED.Visible = xlSheetVeryHidden
        shCLOSED.Visible = xlSheetVeryHidden
        shWEEKLYVOLUME.Visible = xlSheetVeryHidden
        shYANKED.Visible = xlSheetVeryHidden
        shDISPATCHED.Visible = xlSheetVeryHidden
        shINDIVIDUAL.Visible = xlSheetVeryHidden
    End Sub

    Kindly advise. Thanks!

    Monday, December 19, 2011 4:08 PM
  • Maybe this trick in below thread will help you to accomplish your goal:

    http://www.excelguru.ca/content.php?162

     

    Hope this helps,


    Daniel van den Berg | Washington, USA | "Anticipate the difficult by managing the easy"
    Monday, December 19, 2011 4:18 PM
    Moderator
  • Thanks Daniel.

    However, I do find it a bit complicated. would you be able to advise with simpler code? Thank you.

    Monday, December 19, 2011 4:48 PM
  • If macros are not enabled, no VBA code runs, so you need to make this a training and process issue I think.

    Rod Gill

    The one and only Project VBA Book Rod Gill Project Management
    Monday, December 19, 2011 8:42 PM
  • Hello,

    Try this:

    Sub ShowLoginSheet()
        Dim sh As Worksheet
        For Each sh In Application.Worksheets
              If sh.Name = "Login" Then
                  sh.Visible = True
              Else
                 sh.Visible = False
              End If
        Next
    End Sub

     

    Nadia

    • Proposed as answer by koshie_me Tuesday, December 20, 2011 3:06 AM
    • Marked as answer by danishaniModerator Wednesday, January 11, 2012 8:41 PM
    Tuesday, December 20, 2011 1:46 AM