Counting in a userform
I made an error, go figure. Corrected and works great
Thanks, Dan
-----Original Message-----
Bob, I am a newbie as if you can't tell! Do I have to
replace the Me and the "Combo box"? Because when I run I
get a compile error:wrong # of arguments or invalid
property asignment. Thanks Dan
-----Original Message-----
Dan,
Count them and output the msgbox from within the form.
If
not more than one,
then exit.
This si some code for running from an OK type button.
'--------------------------------------------------------
-
--------
Private Sub Commandbutton1_Click()
'--------------------------------------------------------
-
--------
Dim ctl As msforms.Control
Dim iCbs As Long
For Each ctl In Me.Controls
If TypeName(ctl) = "ComboBox" Then
If ctl.ListIndex < -1 Then
i=i+1
If i 1 Then
MsgBox "Only select one"
Exit Sub
End If
End If
End If
Next ctl
Me.Hide
End Sub
--
HTH
RP
(remove nothere from the email address if mailing direct)
"Dan" wrote in
message
...
I have 10 combo boxes in a userform frame. I would like
the user to select just ONE combo box. If any more
than
2
are select, and before my ActiveCell.Offset updates the
spreadsheet. I would like to catch this multiple input
error and send msgbox then Cancel=true back to the
userform for correction.
My 10 combo's are as follows:
cboA.Value
.
.
cboJ.Value
I thought that I could loop and count, if count great
than
1, stop and message, return and correct. My code
locked
me
up. Thanks.
.
.
|