Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default 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   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro with protect sheet Pyrite Excel Discussion (Misc queries) 1 October 10th 08 05:03 PM
Code to protect/unprotect a sheet using a macro with password FredH Excel Discussion (Misc queries) 5 October 23rd 07 04:49 PM
protect sheet macro problems Nikki Excel Discussion (Misc queries) 2 May 25th 07 04:55 AM
Protect sheet in macro traima Excel Worksheet Functions 3 March 9th 07 06:05 PM
Using macro to un/protect sheet Bonbon Excel Worksheet Functions 2 February 23rd 06 08:14 PM


All times are GMT +1. The time now is 05:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"