passwords

  • Thread starter Thread starter Karen
  • Start date Start date
K

Karen

Hello,

I have a workbook with 25 sheets in it. Each sheet is a
time card for an employee. I want to create a macro
(probably use a button) that requests a password to
unprotect the sheet, then reveals the contents of that
sheet (kept hidden with either the outline tool or just
hidden columns).

When the user is finished, they must re-hide and re-
protect with their password.

I set this up without macros, but folks kept hiding their
columns and not remembering to put back the password
protection.

Any help is appreciated.

Thanks,

Karen
 
You might want to look at the sheet deactivate event
right click sheet tab> view code>left window select worksheet:>right window
select sheet deactivate
 
Suggest you have a worksheet (or form) for selecting the required employee,
which contains a list (in a named range) of employees and passwords (both
hidden, with the worksheet password protected). Use a cell with data
validation as "select from list" to select the employee name or number.
Provide a button to run a macro which looks at the employee selection, asks
for their password in a textbox on a form with the "passwordchar" property
set to "*" (or if on-screen secrecy of password entry is not required use
an inputbox). Check this against the matching password (use vlookup from the
employee selection cell to find it in the employee+password list)
Then you can make the required worksheet (only) visible.
You could use a workbook.BeforeClose event to prompt the user to confirm
saving, and in any event re-hide all employee worksheets (by iterating
through the list). Perhaps a button should be put on every employee
worksheet that runs a macro to save & close the workbook, which could also
hide all employee sheets.
Look at Excel VBA help under the worksheet.visible property, which can be
set to xlVeryHidden, meaning it can only be made visible again from code
You would also need an admin password and associated code to provide
button/macro access to make all worksheets visible for the person who is to
make use of the data they enter.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top