Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error locking cell
Hi,
I receive the following error when trying to lock a cell via a macro - "Unable to set the Locked Property of the Range class.". My code basically writes a value into an unlocked cell, unprotects the sheet, changes the cell to locked, then re-protects the sheet. Code is below: Range("O73").Select ActiveCell.FormulaR1C1 = "CHECKED" ActiveSheet.Unprotect Password:="ABC" Selection.Locked = True ActiveSheet.Protect Password:="ABC" The error occurs at "Selection.Locked" stage. Can anyone help me????? Thanks, Richard. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error locking cell
Richard,
I've just tried your code in a command button and it worked ok, no probs. Where are you running the code from? "RSimp321" wrote: Hi, I receive the following error when trying to lock a cell via a macro - "Unable to set the Locked Property of the Range class.". My code basically writes a value into an unlocked cell, unprotects the sheet, changes the cell to locked, then re-protects the sheet. Code is below: Range("O73").Select ActiveCell.FormulaR1C1 = "CHECKED" ActiveSheet.Unprotect Password:="ABC" Selection.Locked = True ActiveSheet.Protect Password:="ABC" The error occurs at "Selection.Locked" stage. Can anyone help me????? Thanks, Richard. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error locking cell
I'm running the code from an excel add-in. The sheet seems to protect and
unprotect fine, but it just fails to lock the cell. "Dean" wrote: Richard, I've just tried your code in a command button and it worked ok, no probs. Where are you running the code from? "RSimp321" wrote: Hi, I receive the following error when trying to lock a cell via a macro - "Unable to set the Locked Property of the Range class.". My code basically writes a value into an unlocked cell, unprotects the sheet, changes the cell to locked, then re-protects the sheet. Code is below: Range("O73").Select ActiveCell.FormulaR1C1 = "CHECKED" ActiveSheet.Unprotect Password:="ABC" Selection.Locked = True ActiveSheet.Protect Password:="ABC" The error occurs at "Selection.Locked" stage. Can anyone help me????? Thanks, Richard. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error locking cell
Only a suggestion but try re-selecting the cell before locking
"RSimp321" wrote: I'm running the code from an excel add-in. The sheet seems to protect and unprotect fine, but it just fails to lock the cell. "Dean" wrote: Richard, I've just tried your code in a command button and it worked ok, no probs. Where are you running the code from? "RSimp321" wrote: Hi, I receive the following error when trying to lock a cell via a macro - "Unable to set the Locked Property of the Range class.". My code basically writes a value into an unlocked cell, unprotects the sheet, changes the cell to locked, then re-protects the sheet. Code is below: Range("O73").Select ActiveCell.FormulaR1C1 = "CHECKED" ActiveSheet.Unprotect Password:="ABC" Selection.Locked = True ActiveSheet.Protect Password:="ABC" The error occurs at "Selection.Locked" stage. Can anyone help me????? Thanks, Richard. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Error locking cell
Only a suggestion? Only the answer to the problem I've been having all
morning! Thanks very much. Richard. "Dean" wrote: Only a suggestion but try re-selecting the cell before locking "RSimp321" wrote: I'm running the code from an excel add-in. The sheet seems to protect and unprotect fine, but it just fails to lock the cell. "Dean" wrote: Richard, I've just tried your code in a command button and it worked ok, no probs. Where are you running the code from? "RSimp321" wrote: Hi, I receive the following error when trying to lock a cell via a macro - "Unable to set the Locked Property of the Range class.". My code basically writes a value into an unlocked cell, unprotects the sheet, changes the cell to locked, then re-protects the sheet. Code is below: Range("O73").Select ActiveCell.FormulaR1C1 = "CHECKED" ActiveSheet.Unprotect Password:="ABC" Selection.Locked = True ActiveSheet.Protect Password:="ABC" The error occurs at "Selection.Locked" stage. Can anyone help me????? Thanks, Richard. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Locking Cell | Excel Worksheet Functions | |||
Locking cell | Excel Discussion (Misc queries) | |||
locking only one cell | Excel Discussion (Misc queries) | |||
locking formula in cells in without locking whole sheet | Excel Discussion (Misc queries) | |||
cell locking via VBA | Excel Programming |