Paste this code on userform_intialize event and run.
Private Sub UserForm_Initialize()
Dim nme As Range
Dim cntrl As Control
Dim CB As ComboBox
For Each cntrl In Me.Controls
If TypeName(cntrl) = "ComboBox" Then
If CB Is Nothing Then
For Each nme In Sheet1.Range("MyName")
cntrl.AddItem nme.Value
Set CB = cntrl
Next
Else
cntrl.List = CB.List
End If
End If
Next
End Sub
Change highlighted part as per your requirement
No comments:
Post a Comment