Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protect Sheet Macro
I am trying to create a macro that will password protect the locked cells in
a spreadsheet. I can get the process to work, and the macro records, but doesn't appear to be recording the actual process of applying the password. In other words, I can just go in and unprotect the sheet, no password required. Is it even possible to record the password into a macro, or does that defeat the purpose? |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protect Sheet Macro
Hi,
Try this Sub sonic() Dim sh As Worksheet For Each sh In ThisWorkbook.Worksheets sh.Protect Password:="MyPass" Next End Sub Mike "jrob54245" wrote: I am trying to create a macro that will password protect the locked cells in a spreadsheet. I can get the process to work, and the macro records, but doesn't appear to be recording the actual process of applying the password. In other words, I can just go in and unprotect the sheet, no password required. Is it even possible to record the password into a macro, or does that defeat the purpose? |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
Protect Sheet Macro
Thanks for the quick response. A couple of questions before I try your text.
Will it lock all worksheets at once? The workbook I am creating is for planning purposes, 12 worksheets, one for each fiscal period. I have created buttons on each sheet to allow one user to "lock" each estimate after the period cutoff. Thus, the macro. I do need the sheets to be locked one at a time though, and there are other worksheets in the book that should not be protected at all. Will your text still work? Sorry, this is new territory for me. J "Mike H" wrote: Hi, Try this Sub sonic() Dim sh As Worksheet For Each sh In ThisWorkbook.Worksheets sh.Protect Password:="MyPass" Next End Sub Mike "jrob54245" wrote: I am trying to create a macro that will password protect the locked cells in a spreadsheet. I can get the process to work, and the macro records, but doesn't appear to be recording the actual process of applying the password. In other words, I can just go in and unprotect the sheet, no password required. Is it even possible to record the password into a macro, or does that defeat the purpose? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro with protect sheet | Excel Discussion (Misc queries) | |||
Code to protect/unprotect a sheet using a macro with password | Excel Discussion (Misc queries) | |||
protect sheet macro problems | Excel Discussion (Misc queries) | |||
Protect sheet in macro | Excel Worksheet Functions | |||
Using macro to un/protect sheet | Excel Worksheet Functions |