View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
merjet merjet is offline
external usenet poster
 
Posts: 812
Default Several comboBoxes on a Userform

I have a Userform with 5 ComboBoxes names "ComboBox1" to "ComboBox5".
How can I make a routine to know which of the five has been selected and

to
get the selection.


This should get you started. If c.ListIndex = -1, the ComboBox hasn't been
selected.
If the ComboBox has been selected, then c.Value will show the value.

HTH,
Merjet

Private Sub UserForm_Click()
Dim c As Control
For Each c In Me.Controls
If TypeName(c) = "ComboBox" Then
MsgBox c.Name & " " & c.ListIndex & " " & c.Value
End If
Next c
End Sub