Access the protected cell via Macro only

harjas

New member
Joined
Jul 26, 2012
Messages
7
Reaction score
0
Points
0
hi,

I'm on the verge of completing my excel program. At the end I was looking to lock all the cells of the sheet except those which require user inputs. I'm running the program mostly via macros.
The problem is that when I protect the sheet, i'm not able to run the macro. (error: the sheet is protected and therefore read-only)

The following options were selected while protecting the sheet:
1) Protect worksheet and content of locked cells (cannot uncheck this option)
2) select unlocked cells

Please help me to lock the cells and meanwhile execute the macro to change values in the locked cells.

Thanks
 
Just unprotect the sheet at the start of your macro and protect it again at the end.
 
After completing the excel program, someone else is going to use it. So, i can't protect and unprotect it each time !

I just want user to select unlocked cells and feed the input. The user should be restricted to change any value in the locked cell. Only background macro should calculate and change the value of the locked cell accordingly.
 
You can, you do it in the code. I do it all the time.

Code:
Worksheets("name").Unprotect

'your code

Worksheets("name").Protect
 
Back
Top