Password protection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is the situation

I have a spreadheet that cycles monthly data.
Each sheet is a new month and 12 are kept in the book
I have a macro that copies information from each sheet to the next showing the last quarter of context for each sheet
Of course only the new quarter's information is editable or should be
So I need to have my macro copy protected information
If the protection is not passworded then I can turn it off, copy, and turn it on
But all the users know this as well and they turn off the protection and ruin the formulas, etc
Further if I password protect it then copying protected cells requires password entry which dosent work because I do not want the users to have the password.
So I need a way to BYPASS the password protection that works for the macro. Id there one
 
Series0, you can have your macro unprotect the sheet, run you code and then
protect the sheet, something like this

ActiveSheet.Unprotect password:="123"
'you code here
ActiveSheet.Protect password:="123"



Or you can still run a macro on a sheet when it is protected using user
inter face only, like this
ActiveSheet.Protect UserInterfaceOnly:=True

Or with a password
ActiveSheet.Protect UserInterfaceOnly:=True, password:="123"

Sheets("Sheet2").Protect UserInterfaceOnly:=True, password:="123"


You can also lock the VBA project to keep someone from seeing the password
in the code, To protect the VBA project, from your workbook right-click the
workbook's icon and pick View Code. This icon is to the left of the "File"
menu this will open the VBA editor, in the left hand window right click on
your workbook name and select VBA project properties, protection, check lock
project for viewing and set a password. Press Alt and Q to close this window
and go back to your workbook and save and close the file
--
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 2000 & 97
** remove news from my email address to reply by email **
series0 said:
Here is the situation:

I have a spreadheet that cycles monthly data.
Each sheet is a new month and 12 are kept in the book.
I have a macro that copies information from each sheet to the next showing
the last quarter of context for each sheet.
Of course only the new quarter's information is editable or should be.
So I need to have my macro copy protected information.
If the protection is not passworded then I can turn it off, copy, and turn it on.
But all the users know this as well and they turn off the protection and ruin the formulas, etc.
Further if I password protect it then copying protected cells requires
password entry which dosent work because I do not want the users to have the
password.
 
Back
Top