+ Reply to Thread
Results 1 to 3 of 3

Password Protect Individual Sheets

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    08-17-2009
    Location
    West Midlands
    MS-Off Ver
    Excel 2016
    Posts
    213

    Password Protect Individual Sheets

    Happy Christmas!

    I have an Excel 2007 workbook. The first sheet contains a drop down menu that takes you to other worksheets within the workbook depending upon the selection you make.

    However, some of the sheets contain sensitive data that I'd like to password protect. i.e. if someone selects 'LAC' (Sheet10) from the drop down list it will ask them to enter a password BEFORE it opens that worksheet.

    Can enyone help?

    Thanks

    Steve

  2. #2
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Password Protect Individual Sheets

    There no really secure method of doing this but you can use the xlVeryHidden worksheet property which means worksheets can be hidden and only made visible using VBA.

    The attached example is quite basic but should give you an idea.

    It uses a Control worksheet to keep a couple of lists on, one of all the worksheets in your workbook other than the Control and Front Sheet ones that may or may not need password protection and another of the sheets that you want to request a password for.

    It then uses a Worksheet Change event on the Front Page sheet to check whether a password is required and display the sheet accordingly.

    The last code are Workbook Open and BeforeClose events to 'very hide' all the sheets as required.

    I've left the Control sheet visible but it should also be very hidden which can be set in the sheet's properties in the VBA editor and you would also need to password the VBA project to stop people seeing your password.

    The code would need some refining but hopefully will point you in the right direction.

    Again, anyone with the knowledge will be able to get round this quite easily but it should put most people off.

    Hope it helps,

    Dom
    Attached Files Attached Files
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  3. #3
    Forum Contributor
    Join Date
    08-17-2009
    Location
    West Midlands
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Password Protect Individual Sheets

    Domski -

    Many thanks for the reply and the example. I'll see if I can adapt it to my workbook!

    Merry Christmas.

    Steve

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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