Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
keep source formatting is not an option in paste option button Tina Excel Discussion (Misc queries) 0 February 20th 06 09:58 PM
Getting value of Option button BG Excel Worksheet Functions 2 September 27th 05 01:47 PM
Option Button Help justaguyfromky Excel Worksheet Functions 2 September 5th 05 10:28 PM
Option Button Help justaguyfromky Excel Discussion (Misc queries) 1 September 5th 05 09:48 PM
option button Mario Excel Discussion (Misc queries) 1 July 26th 05 07:44 PM


All times are GMT +1. The time now is 11:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"