Protection & Macros

  • Thread starter Thread starter Catherine
  • Start date Start date
C

Catherine

How can I protect cells within my worksheets allowing
macros to enter data into them but not users???

Thanks in advance.

Catherine.
 
Hi Catherine!

You need to insert code into your macros:

For j = 1 To Worksheets.Count
Worksheets(j).UnProtect Password:="not4u2see"
Next j

<your code that enters data>

For j = 1 To Worksheets.Count
Worksheets(j).Protect Password:="not4u2see"
Next j



The above allows entry of data into any of the sheets assuming all use
the same password. Modify for a single sheet with data entry or where
you use different passwords for different sheets.
 
Alternatively, set the UserInterFaceOnly argument to true
eg
Worksheets("Sheet1").Protect password:="password"
UserInterFaceOnly:= True
 
Hi,

Usee the ActiveSheet.Unprotect "david"<< your password
At the begining of the Macro and when macro is done reset th
password.
ActiveSheet.Protect Password:="david"<<<< your password.


HTH Charle
 
Hi Norman,
But can we prevent users not to "see" the password from the macro code?
TIA
 
Hi Martyn!

Protect the Macro code. It's under the Tools menu in VBA.
 
I already know that...but thank you anyway.
Best wishes
Martyn


Norman Harker said:
Hi Martyn!

Protect the Macro code. It's under the Tools menu in VBA.



--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top