Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5
Default Password for cell protection within VBA

I have a VBA routine where the user inputs several items & then clicks
a "calc" button to get an answer that is then entered into a certain
cell by the VBA code. I want to enable protection (w/password) so
that only the user input cells can be selected/edited. I added code
for the calc button to unprotect the sheet, enter the answer into the
cell, and then turn protection back on. My problem is that upon
execution of the line that unprotects the sheet, a dialog box pops up
for the user to enter the "protection" password, which they of course
do not have.

How can I use VBA code to provide the password?
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Password for cell protection within VBA

Mike,

hard code the password

ActiveSheet.Unprotect Password:="MyPass"
'do things
ActiveSheet.Protect Password:="MyPass"

Mike

"Mike" wrote:

I have a VBA routine where the user inputs several items & then clicks
a "calc" button to get an answer that is then entered into a certain
cell by the VBA code. I want to enable protection (w/password) so
that only the user input cells can be selected/edited. I added code
for the calc button to unprotect the sheet, enter the answer into the
cell, and then turn protection back on. My problem is that upon
execution of the line that unprotects the sheet, a dialog box pops up
for the user to enter the "protection" password, which they of course
do not have.

How can I use VBA code to provide the password?

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
Password Protection - paste to unprotected cell locks the cell Jimbob Excel Discussion (Misc queries) 7 September 7th 07 06:22 PM
Password Protection ElsiePOA Excel Discussion (Misc queries) 6 July 25th 06 05:25 AM
Password Protection DNA Excel Discussion (Misc queries) 0 May 3rd 06 01:59 PM
Password Protection Susan Excel Discussion (Misc queries) 9 February 8th 06 09:06 AM
Cell Password Protection-Multiple Worksheets GW Trainer Excel Worksheet Functions 0 May 19th 05 07:58 PM


All times are GMT +1. The time now is 12:58 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"