Groups in Option buttons
What I suggested should work similarly with Optionbuttons on a Userform as
on a sheet and code behind the sheet module.
Regards,
Peter T
"Greg B" wrote in message
...
Sorry about the lack of reply it was 5.30 in the morning and i was
grasping
for the answer. I loaded the option boxes in the userform section. I have
built this using the userform side of the equation.
Thanks Greg
"Peter T" <peter_t@discussions wrote in message
...
Not sure I'm much the wiser. Guessing as to what you have and want to
achieve - following should work with ActiveX OptionButtons whether on a
form or on a sheet:
Private Sub OptionButton1_Click()
ProcessOB OptionButton1
End Sub
Private Sub OptionButton2_Click()
ProcessOB OptionButton2
End Sub
Private Sub ProcessOB(ob As MSForms.OptionButton)
Dim sCap As String, sGrp As String
With ob
sGrp = .GroupName
sCap = .Caption
End With
Select Case sGrp
Case "expenses"
Me.reason.Text = s
' maybe set some module level variable here
Case "tips"
' code
End Select
MsgBox sCap, , sGrp
End Sub
You might also look into using 'WithEvents' to handle events of multiple
similar controls a class module.
Regards,
Peter T
"Greg B" wrote in message
...
Yeah I didn't make much sence sorry, I have a group of 7 optionbuttons
in a group called "expenses".
Instead of going throught all with the code for each individual
optionbox, I was wondering if there was a way to have the selected box
put it's caption into a textbox called reason.
Hope that is a bit more understandable.
Thanks Again
Greg
|