View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
John John is offline
external usenet poster
 
Posts: 2,069
Default ComboBox Drop Down List

Another way perhaps.

Private Sub UserForm_Initialize()
Dim ctl As Control
Dim CtrlType As String

For Each ctl In UserForm1.Controls

CtrlType = TypeName(ctl)

If CtrlType = "ComboBox" Then

ctl.AddItem "Yes"
ctl.AddItem "No"
ctl.ListIndex = 0

End If
Next ctl
End Sub
--
jb


"Johnny" wrote:

I have 14 Combo Boxes on my Excel form that I want to populate with "Yes" and
"No" with the initialize event. The only way I know how to do it is to use
the following code for each ComboBox.

With ComboBox#
.AddItem "Yes"
.AddItem "No"
End With

Is there simpler code to accomplish this?

Thank you