Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Kelly
 
Posts: n/a
Default Add protect worksheet password in macro

I created 43 sets of workbooks that need to be locked and protected from end
users. I have created a macro that will clear the previos days numbers and
copies on cell to another which are both locked. My macro won't run with
those two cells being locked. I tried to create a macro that unprotects the
worksheet, does all actions needed then protects the worksheet again. When I
run the macro the first thing that pops up is the password entry box. It
didn't put the password I entered in the code. Can I add the password to it
and if so how? I'm new at writing macros and code in Excell.
--
Thank you, Kelly
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Paul B
 
Posts: n/a
Default Add protect worksheet password in macro

Kelly, here is one way,

Const PW As String = "123" 'Change Password Here
ActiveSheet.Unprotect Password:=PW
'you code here
ActiveSheet.Protect Password:=PW


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"Kelly" wrote in message
...
I created 43 sets of workbooks that need to be locked and protected from

end
users. I have created a macro that will clear the previos days numbers

and
copies on cell to another which are both locked. My macro won't run with
those two cells being locked. I tried to create a macro that unprotects

the
worksheet, does all actions needed then protects the worksheet again.

When I
run the macro the first thing that pops up is the password entry box. It
didn't put the password I entered in the code. Can I add the password to

it
and if so how? I'm new at writing macros and code in Excell.
--
Thank you, Kelly



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
Protect Workbook vs Worksheet?? Dan B Excel Worksheet Functions 3 November 7th 05 09:02 PM
how do i password protect an .xls file? how do i unlock it for automation. e.g. want to unlock and access a .xls from another .xls macro. Daniel Excel Worksheet Functions 1 June 24th 05 02:59 PM
Password Protect Cells Dharsh Excel Discussion (Misc queries) 3 April 28th 05 04:12 PM
Macro to simply bring up the Find dialogue box?? marika1981 Excel Discussion (Misc queries) 14 January 14th 05 10:47 PM
How to protect my macro Protect & Unprotect Several Worksheets Excel Discussion (Misc queries) 1 January 7th 05 02:01 AM


All times are GMT +1. The time now is 12:28 PM.

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

About Us

"It's about Microsoft Excel"