Combo Box - Drop Down Box
Private Sub CommandButton1_Click()
Dim cb As OLEObject
On Error Resume Next
Set cb = ActiveSheet.OLEObjects.Add _
(classtype:="Forms.combobox.1", Link:=False _
, displayasicon:=False)
With cb
.Name = "myname"
.Left = Columns("B:E").Left
.Width = Columns("B:E").Width
.Height = Rows("10:11").Height
.Top = Rows("10:11").Top
.ListFillRange = "Sheet2!A1:A11"
End With
End Sub
Combo Box - Add & Delete values
Private Sub CommandButton1_Click()
Dim i As Integer
For i = 1 To 11
ComboBox1.AddItem i
Next
End Sub
Private Sub CommandButton2_Click()
ComboBox1.Clear
End Sub
Combo Box - ADD ARRAY values
Private Sub CommandButton1_Click()
Dim cb As OLEObject
Set cb = ActiveSheet.OLEObjects.Add(classtype:="Forms.combobox.1", Link:=False _
, displayasicon:=False)
With cb
.Name = "myname"
.Left = Columns("B:E").Left
.Width = Columns("B:E").Width
.Height = Rows("10:11").Height
.Top = Rows("10:11").Top
End With
cb.Object.List = Array("a", "b", "c", "d", "f")
End Sub
Add Data to combobox in Userform
Combo Box - Userform
Combo Box - Click event
Private Sub ComboBox1_Click()
If ComboBox1.Value = 5 Then
Exit Sub
End If
End Sub