P
Paul Kraemer
Hi,
I am using Excel 2007. I have written some VBA code that sets the values in
certain cells using code like the following:
Worksheets("MySheet").Range("A5") = MyValue
This code works when my worksheet is not protected and cell A5 is not
locked. When I protect the worksheet (with A5 locked), my code does not
work. I get run-time error '1004' - "The cell or chart that you are trying
to change is protected and therefore read-only".
I'd like to keep the cell locked (so users cannot edit it), but I do want my
VBA code to be able change the value. Do I have to temporarily unlock the
cell (using VBA) before my code attempts to make a change and then relock the
cell it when my code is done? Or is there an easier way to do this?
Thanks in advance,
Paul
I am using Excel 2007. I have written some VBA code that sets the values in
certain cells using code like the following:
Worksheets("MySheet").Range("A5") = MyValue
This code works when my worksheet is not protected and cell A5 is not
locked. When I protect the worksheet (with A5 locked), my code does not
work. I get run-time error '1004' - "The cell or chart that you are trying
to change is protected and therefore read-only".
I'd like to keep the cell locked (so users cannot edit it), but I do want my
VBA code to be able change the value. Do I have to temporarily unlock the
cell (using VBA) before my code attempts to make a change and then relock the
cell it when my code is done? Or is there an easier way to do this?
Thanks in advance,
Paul