Okay, I'll try to explain but there's one book I would recommend, "it's Excel
2002 Power Programming with VBA", ISBN: 0-7645-4799-2 (there's a 2003 version
but apparently there wasn't much extra added). This book alone taught me so
much; it's an EXCELLENT resource and very well written!
The radio button, technically known as the Option Button. Create a Frame
(click on Frame in the Toolbox in the VBA editor) on the user form and place
your option buttons inside it. This will group those option buttons so only
one will be True at any time when clicked. When another one is clicked the
other will one will automatically clear (become False). It does not matter
how many option buttons you have in a Frame (or group).
The other method doesn't require using a Frame. The option buttons are
placed on the user form. For each option button you want to be grouped
together (so when one is selected the other(s) are deselected), select it,
and in the Properties window set the GroupName to a common string
(descriptor). For example, if you have two option buttons on the form and
you want them to "see" each other, set the GroupName for both of them to the
same value, maybe "Gender" if one button is "Male" and the other button is
"Female".
I recommend using a Frame because it visually groups the option buttons --
or any other group of controls -- for the user. The Frame has a caption,
too. In our above example, you could set the Caption of the Frame to "What
is your gender?", thus instantly allowing the user to know what or why they
are selecting. Also, there's no need to set the GroupName for the option
buttons in a Frame :-) Does this help?
Yes, the MVP's are life-savers! I truely appreciate their dedicated
talents. The list of links I have is not complete but it contains the ones I
use most when I go from job to job.
--
Toby Erkson
http://excel.icbm.org/
"Francis Hookham" wrote:
> Thanks for your comment Toby. Although an XL user (inc Multiplan) days it
> has been as a self taught amateur, not good at reading complicated text
> books. Can you point me to a simple explanation of the need for grouping
> radio buttons.
>
>
>
> I have grouped the buttons and using Gary's
>
> userform1.optionbutton1=false
>
> all is well.
>
>
>
> Thank you also for the link to your website - it is now a Links bar
> favourite named 'XL' so I can keep an eye on you and get to the very useful
> Links page - recently, by mistake, I wiped all my links to those amazing
> MVPs.
>
>
>
> Thanks from Cambridge, UK
>
>
>
> Francis
>
>
>
>
> "Air_Cooled_Nut" <(E-Mail Removed)> wrote in message
> news:E8CF5C97-48E3-452B-8F81-(E-Mail Removed)...
> > When radio buttons are together in a group, like in a Frame, then clicking
> > one will automatically clear the other. So it sounds like your Option
> > Buttons aren't properly grouped with each other.
> > --
> >
> > Toby Erkson
> > http://excel.icbm.org/
> >
> >
> > "Francis Hookham" wrote:
> >
> >> The clicked radio button in a UserForm does not clear so clicking the
> >> same
> >> button again does not work, whereas clicking another radio button next
> >> does
> >> work.
> >>
> >>
> >>
> >> Is there an instruction I should incorporate to clear the previous
> >> clicking
> >> of the button? If so what and where should it go?
> >>
> >>
> >>
> >> Francis Hookham
> >>
> >>
> >>
> >> --------------------------------------------------------------
> >>
> >>
> >>
> >> Private Sub OptionButton6_Click()
> >>
> >> 'colour frame(s) orange
> >>
> >> Userform1.Hide
> >>
> >> ColourOrange
> >>
> >> End Sub
> >>
> >>
> >>
> >> Sub ColourOrange()
> >>
> >> FindFrameRow
> >>
> >> 'set colour
> >>
> >> ActiveWorkbook.Colors(21) = RGB(255, 245, 225)
> >>
> >> FillColour = 21
> >>
> >> OneShotColour
> >>
> >> End Sub
> >>
> >>
> >>
> >> Sub FindFrameRow()
> >>
> >> If ActiveCell.Row = 1 Or ActiveCell.Row = 2 Then
> >>
> >> RowNo = 3
> >>
> >> Else
> >>
> >> RowNo = ActiveCell.Row
> >>
> >> While Cells(RowNo, 1) = ""
> >>
> >> RowNo = RowNo - 1
> >>
> >> Wend
> >>
> >> End If
> >>
> >> Cells(RowNo, 1).Select
> >>
> >> End Sub
> >>
> >>
> >>
> >> Sub OneShotColour()
> >>
> >> 'given 'RowNo', this performs the colour change of one shot
> >>
> >> Range(Cells(RowNo, 2), Cells(RowNo + 15, 10)). _
> >>
> >> Interior.ColorIndex = FillColour
> >>
> >> Cells(RowNo, 7).Interior.ColorIndex = xlNone
> >>
> >> Cells(RowNo, 9).Interior.ColorIndex = xlNone
> >>
> >> End Sub
> >>
> >>
> >>
>
>
>