Gruppe
Dialog
Problem
Im aktiven Blatt soll eine neue ComboBox mit LinkedCell- und ListFillRange-Zuweisung erstellt werden.
StandardModule: Modul1
Sub AddComboBOx()
Dim oObj As OLEObject
Dim oCbox As MSForms.ComboBox
Dim cell As Range
Set oObj = ActiveSheet.OLEObjects.Add( _
ClassType:="Forms.ComboBox.1", _
Link:=False, _
DisplayAsIcon:=False, _
Left:=20, _
Top:=50, _
Width:=150, _
Height:=20)
Set oCbox = oObj.Object
oCbox.LinkedCell = Range("F1")
oObj.ListFillRange = Range("G1:G12").Address
oCbox.ListIndex = 0
End Sub