Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default 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
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
How do I add a control check box to control other checkboxes? JGarland Excel Worksheet Functions 1 September 18th 08 12:26 PM
Difference between a Forms Control verus Active-X Control funGT350 Excel Discussion (Misc queries) 6 May 6th 08 11:20 PM
Forms - Checkboxes Jane Excel Worksheet Functions 3 October 3rd 06 02:21 PM
Forms control checkboxes on charts routeram Excel Programming 1 September 13th 04 12:38 AM
Can you hide forms checkboxes Matt Excel Programming 2 January 10th 04 06:32 PM


All times are GMT +1. The time now is 03:53 AM.

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"