Checkbox to show 1 of 2 cells value

directx

New Member
Joined
Aug 2, 2017
Messages
13
Hello everyone,

I have a problem with controling CheckBoxes.

1st I want to forbid checking both of CheckBoxes, maybe like automaticly uncheck 1st box when I check 2nd.

2nd Since it is imposible to check both boxes in a same time, I want to in cell I3 show value of cell C2 if Checkbox 1 is checked, if Checkbox 2 is checked, I want to display value of Cell C4 in same I3 cell. Same thing goes for J3 and cells C3 and C5.



Is it posible?



Best Regards
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You can do that with VBA. However, I'd recommend looking into radio buttons instead of check boxes. If you set up 2 radio buttons with the same group, that only allows one of them to be selected at the same time. Then you can use ordinary worksheet functions in I3 and J3 to look at the value of the radio button, and display the values you want.
 
Upvote 0
I've been told it's easier+safer to use the controls as intended, which means you want a pair of radio buttons here, in the same group:
Code:
Option Explicit

Private Sub OptionButton1_Click()
    updI3
End Sub

Private Sub OptionButton2_Click()
    updI3
End Sub

Private Sub updI3()
    If OptionButton1 Then
        Range("$I$3") = Range("$C$3").Value2
    ElseIf OptionButton2 Then
        Range("$I$3") = Range("$C$4").Value2
    End If
            
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,747
Messages
6,180,719
Members
452,995
Latest member
isldboy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top