Locked Sheet

  • Thread starter Thread starter scrabtree23
  • Start date Start date
S

scrabtree23

I want to write a VB Code that will change the formula in
one cell on a locked sheet that is password protected? I
know the password. It is a program that several people
are using and I want to sent them an update to fix a
glitch. However, I don't know the code to change a cell
on a locked page??????

SDC
 
Sheets("SheetName").Protect Password:="rob1"

Sheets("SheetName").Unprotect Password:="rob1"

Note that a space is required before the word "password". HTH Otto
 
The easiest way I can think of is to unlock the sheet,
make the changes and lock it again.

For example
1)Unprotect the sheet
sheet1.unprotect, "password"

2)Change the formula
Sheet1.Range("a1").FormulaR1C1 = "=RC[1]+RC[2]"

3)Re-protect the sheet
sheet1.protect, "password"

If you haven't already you could in future
try "Userinterface :=true" which allows code to alter a
sheet but prevents the user from doing so.

hope this helps
libby
 
Back
Top