Gruppe
Dialog
Bereich
ComboBox
Thema
ComboBox in Arbeitsblatt erstellen und füllen
Problem
Im aktiven Blatt soll eine ComboBox mit den Monatsnamen als Inhalt erstellt werden.
Lösung
Geben Sie den Ereigniscode in die nachfolgend genannten Module ein.
StandardModule: Modul1
Sub NewCboBox()
Dim cbo As OLEObject
Dim iCounter As Integer
Range("A1").Select
Set cbo = ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.ComboBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=40, _
Top:=40, _
Width:=170, _
Height:=20)
For iCounter = 1 To 12
cbo.Object.AddItem Format(DateSerial(1, iCounter, 1), "mmmm")
Next iCounter
cbo.Object.ListIndex = 0
End Sub