Results 1 to 6 of 6

How to hide certain sheets with password

Threaded View

  1. #1
    Registered User
    Join Date
    11-16-2011
    Location
    Copenhagen
    MS-Off Ver
    Excel 2003
    Posts
    2

    How to hide certain sheets with password

    Hello

    I´m trying to achieve the possibility to hide some sheets with a password, but not all.

    I found this thread:
    http://www.excelforum.com/excel-prog...-password.html

    Where all the sheets are hidden with a password, but since I'm not a coder, I´m not able to get some of the sheets to be hidden and some visible by default.

    The workbook has this:
    Option Explicit
    
    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    Dim ws As Worksheet
    
        For Each ws In ThisWorkbook.Worksheets
            If ws.Name <> "Sheet1" Then ws.Visible = xlSheetVeryHidden
        Next ws
        
        ThisWorkbook.Save       'saves wb again without asking
        
    End Sub
    and the module:

    Option Explicit
    
    Sub PwdCheck()
    Dim Pwd As String
        
        Select Case LCase(Application.InputBox("Please enter your password", "test", Type:=2))
            Case "john"
                Sheets("Sheet2").Visible = xlSheetVisible
            Case "sam"
                Sheets("Sheet3").Visible = xlSheetVisible
            Case "admin"
                Sheets("Sheet2").Visible = xlSheetVisible
                Sheets("Sheet3").Visible = xlSheetVisible
        End Select
    
    End Sub
    Hope someone can help me.
    Attached Files Attached Files
    Last edited by marcielo; 11-17-2011 at 11:21 AM. Reason: Forgot to attach file

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1