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 |
All times are GMT +1. The time now is 06:04 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com