Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Forms control checkboxes on charts
How about:
Option Explicit Sub cbx_click() Dim CBX As CheckBox Dim OtherCBX As CheckBox With ActiveChart Set CBX = .CheckBoxes(Application.Caller) If LCase(CBX.Name) = "check box 1" Then Set OtherCBX = .CheckBoxes("check box 2") Else Set OtherCBX = .CheckBoxes("check box 1") End If End With If CBX.Value = xlOn Then OtherCBX.Value = xlOff End If End Sub You can change the name of a checkbox by selecting it (sometimes rightclicking on it is easier) and then typing the new name into the namebox (to the left of the formulabar). Remember to hit enter when you're done typing. But if you change the names of the checkbox, you'll have to change the code. I used "check box 1" and "check box 2". routeram wrote: Hi, I have 2 checkboxes (forms) on a chart. I would like to have just one checkbox checked at anytime. I know a radiobutton would do the same but I need only 2 checkboxes since they don't fall into a single category. What do I have to do to achieve this? I tried to group them but it doesn't help. How do I write code for this? Also is it possible to change the names of these checkboxes from checkboxN to something else? Please help. Regards, Ram -- Dave Peterson |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Forms control checkboxes on charts
And I allowed both checkboxes to be unchecked.
Dave Peterson wrote: How about: Option Explicit Sub cbx_click() Dim CBX As CheckBox Dim OtherCBX As CheckBox With ActiveChart Set CBX = .CheckBoxes(Application.Caller) If LCase(CBX.Name) = "check box 1" Then Set OtherCBX = .CheckBoxes("check box 2") Else Set OtherCBX = .CheckBoxes("check box 1") End If End With If CBX.Value = xlOn Then OtherCBX.Value = xlOff End If End Sub You can change the name of a checkbox by selecting it (sometimes rightclicking on it is easier) and then typing the new name into the namebox (to the left of the formulabar). Remember to hit enter when you're done typing. But if you change the names of the checkbox, you'll have to change the code. I used "check box 1" and "check box 2". routeram wrote: Hi, I have 2 checkboxes (forms) on a chart. I would like to have just one checkbox checked at anytime. I know a radiobutton would do the same but I need only 2 checkboxes since they don't fall into a single category. What do I have to do to achieve this? I tried to group them but it doesn't help. How do I write code for this? Also is it possible to change the names of these checkboxes from checkboxN to something else? Please help. Regards, Ram -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I add a control check box to control other checkboxes? | Excel Worksheet Functions | |||
Difference between a Forms Control verus Active-X Control | Excel Discussion (Misc queries) | |||
Forms - Checkboxes | Excel Worksheet Functions | |||
Forms control checkboxes on charts | Excel Programming | |||
Can you hide forms checkboxes | Excel Programming |