Protection & Macros

C

Catherine

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

Thanks in advance.

Catherine.
 
N

Norman Harker

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.
 
D

DENNIS

Alternatively, set the UserInterFaceOnly argument to true
eg
Worksheets("Sheet1").Protect password:="password"
UserInterFaceOnly:= True
 
C

Charles

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
 
M

Martyn

Hi Norman,
But can we prevent users not to "see" the password from the macro code?
TIA
 
Top