Force TRUE in a check box as result from an option button??

  • Thread starter Thread starter Confused
  • Start date Start date
C

Confused

I have a set of option buttons and a set of check boxes. One of the check
boxes is for a certain value that is similar to one of the option buttons.
Essentially, what I want is for that check box to automatically go to a
"TRUE" (checked) state when the certain option button is selected. When the
other option buttons are selected, the check box will remain in it's normal
state which will allow the user to select it or not depending on other
variables.

But, if the option button is on that certain selection, I would like to make
it so that check box MUST remain on TRUE, and not be able to be changed from
that state as long as the option button is on that option.

Any ideas if this is even possible?

Thanks
Conf.
 
Code performed on the OnClick event of the desired Option Button and / or the
desired Check Box similar to the following should work:

Private Sub (NameOfDesiredCheckBox)_Click()
If (NameOfDesiredOptionButton) Then
(NameOfDesiredCheckBox).Value = True
End If
End Sub

Private Sub (NameOfDesiredOptionButton)_Click()
Me.(NameOfDesiredCheckBox) = True
End Sub

Start Example ****
Private Sub CheckBox1_Click()
If OptionButton1 Then
CheckBox1.Value = True
End If
End Sub

Private Sub OptionButton1_Click()
Me.CheckBox1 = True
End Sub

End Example ****

Good Luck.
 
Ah, thanks, I suspected a VBA solution would be something easy like that,
but was hoping to keep it out of the VBA realm. That warning about macros
when you open a file confuses some users. I'll give it a try though, thanks
again.

Conf.
 
Hmmmm... can't seem to get it to work. Let me see if I'm doing this right:

I right click on the check box I want to work on, select assign macro, and
that will tell me the name of the check box, correct? That's about the only
way I can find that mentions a name for it. So, cancel that dialog, do the
same on the option button, and plug those names into the macro:

Private Sub CheckBox60_Click()
If OptionButton74 Then
CheckBox60.Value = True
End If
End Sub

Private Sub OptionButton74_Click()
Me.CheckBox60 = True
End Sub

I right-click on the tab for the sheet I want it to work in, select view
code from the pop up and paste the above into the VBA area for that sheet,
save and click on the option button and nothing happens to the check box?
Please let me know if I messed that up somewhere. I can usually find my way
around VBA after a lot of stumbling and trial and error, but I've never used
VBA for Excel before. BTW this is Excel 2000 if that makes a difference.

Thanks again

Conf.
 
The VBA code is NOT entered into the code for the WorkSheet, rather it is
entered into the code of the UserForm you create that has the Option Buttons
and the Check Box.

If you would like further assistance, provide me with your email address and
I will contact you. Example:

jdoe

hotmail.com

Note: I intentionally left the at sign out of your address and broke it into
3 lines.

I hope that will work.
 
Ah, OK, I knew something was wonky. I've done that sort of VBA in another
application, and that was in a dialog as well. Unfortunately, these check
boxes and option buttons are not in a dialog, but are in the Excel sheet
itself. They link directly to cells in the sheet and pass on information
from there.

So I guess it's not going to work that way, I have another method to fix it,
it just doesn't work very well, but will get by.

Thanks for the help.

Conf.
 
Back
Top