Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
When using an Option Button can I...
Lock a particular cell?
I have optYes and optNo. When optYes is selected I would like the contents of cell M42 on worksheet WS2 to have a "locked" state, whereas no data can be entered. And when optNo is selected I would like the contents to be fully editable. Is there such a work-around for this? Thanks in advance for your help. Phil Diederich |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
When using an Option Button can I...
I assume the option buttons are on a worksheet and they're from the Forms
toolbar... You can right-click each button, pick Assign Macro to name a macro to be run when each option button is clicked. The code could be: Sub OptionButton1_Click() Range("M42").Locked = True End Sub Sub OptionButton2_Click() Range("M42").Locked = False End Sub If the sheet is protected you will have to unprotect/re-protect it before and after. -- Jim Rech Excel MVP "phil" wrote in message ... | Lock a particular cell? | | I have optYes and optNo. When optYes is selected I would | like the contents of cell M42 on worksheet WS2 to have a | "locked" state, whereas no data can be entered. And when | optNo is selected I would like the contents to be fully | editable. Is there such a work-around for this? | | Thanks in advance for your help. | | Phil Diederich |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
When using an Option Button can I...
Yes they are from the Forms toolbar. Is there any code
that would automatically unprotect and protect the worksheet? I am working with a few numbskulls who aren't proficient with a PC. Would the following work? Sub optYes_Click() Worksheets("WS2").Protect.Password := "xxxxx" End Sub -----Original Message----- I assume the option buttons are on a worksheet and they're from the Forms toolbar... You can right-click each button, pick Assign Macro to name a macro to be run when each option button is clicked. The code could be: Sub OptionButton1_Click() Range("M42").Locked = True End Sub Sub OptionButton2_Click() Range("M42").Locked = False End Sub If the sheet is protected you will have to unprotect/re-protect it before and after. -- Jim Rech Excel MVP "phil" wrote in message ... | Lock a particular cell? | | I have optYes and optNo. When optYes is selected I would | like the contents of cell M42 on worksheet WS2 to have a | "locked" state, whereas no data can be entered. And when | optNo is selected I would like the contents to be fully | editable. Is there such a work-around for this? | | Thanks in advance for your help. | | Phil Diederich . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
When using an Option Button can I...
You're close. Check out the Protect method in Help for the exact syntax.
-- Jim Rech Excel MVP wrote in message ... Yes they are from the Forms toolbar. Is there any code that would automatically unprotect and protect the worksheet? I am working with a few numbskulls who aren't proficient with a PC. Would the following work? Sub optYes_Click() Worksheets("WS2").Protect.Password := "xxxxx" End Sub -----Original Message----- I assume the option buttons are on a worksheet and they're from the Forms toolbar... You can right-click each button, pick Assign Macro to name a macro to be run when each option button is clicked. The code could be: Sub OptionButton1_Click() Range("M42").Locked = True End Sub Sub OptionButton2_Click() Range("M42").Locked = False End Sub If the sheet is protected you will have to unprotect/re-protect it before and after. -- Jim Rech Excel MVP "phil" wrote in message ... | Lock a particular cell? | | I have optYes and optNo. When optYes is selected I would | like the contents of cell M42 on worksheet WS2 to have a | "locked" state, whereas no data can be entered. And when | optNo is selected I would like the contents to be fully | editable. Is there such a work-around for this? | | Thanks in advance for your help. | | Phil Diederich . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
keep source formatting is not an option in paste option button | Excel Discussion (Misc queries) | |||
Getting value of Option button | Excel Worksheet Functions | |||
Option Button Help | Excel Worksheet Functions | |||
Option Button Help | Excel Discussion (Misc queries) | |||
option button | Excel Discussion (Misc queries) |