danke norbert, aber habe noch immer ein kleines problem: ich erstelle die combobox automtaisch, wenn ich ein neues blatt per makro einrichte, soweit so gut. aber ich möchte, dass nachher wenn auf einen eintrag geklickt wird, dass eine neue zeiele eingefügt wird und das funktioniert nicht, ich hänge die programme an:zur erstellung der neuen combobox:
Sub Combo_click()
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:=760.588235294118, _
Top:=167.647058823529, _
Width:=202.058823529412, _
Height:=23.8235294117647)
Set oCbox = oObj.Object
oObj.ListFillRange = Range("AE1:AE100").Address
oCbox.ListIndex = 0
End Sub
und dann die Änderung
Sub ComboBox1_Change()
Dim a As Variant
Dim b As Integer
Dim c As Integer
Dim i As Integer
Dim ag As String
c = Cells(2, 6).Value
a = Cells(3, 7).Value
If ComboBox1.Value = Empty Then
If MsgBox("Möchten Sie einen anderen Auftraggeber hinzufügen?", vbOKCancel) = vbCancel Then GoTo endo
ag = InputBox("Geben Sie den Namen des neuen Auftraggebers ein:")
If ag = Empty Then GoTo endo
Range(Cells(c - 5, 7), Cells(c + 2, 20)).Select
Application.CutCopyMode = True
Selection.Copy
Range(Cells(c + 3, 7), Cells(c + 10, 20)).Select
ActiveSheet.Paste
Range("F2").Value = Range("F2").Value + 11
Cells(c - 4, 9).Value = ag
Cells(c - 1, 9).Select
End If
For i = 2 To c
If Cells(i, 9).Value = ComboBox1.Value Then
If MsgBox("Möchten Sie eine neue Zeile einfügen?", vbOKCancel) = vbCancel Then GoTo endo
b = Cells(i + 3, 6).Value
Rows(b).Select
Selection.Insert Shift:=xlDown
Rows(b).Select
Selection.Copy
Rows(b - 1).Select
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Range(Cells(b - 1, 11), Cells(b - 1, 12)).Select
Selection.Copy
Range(Cells(b, 11), Cells(b, 12)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas
Range(Cells(b + 1, 11), Cells(b + 1, 12)).Select
Selection.PasteSpecial Paste:=xlPasteFormulas
Cells(b - 1, 17).Select
Selection.Copy
Cells(b, 17).Select
Selection.PasteSpecial Paste:=xlPasteFormulas
Cells(b + 1, 17).Select
Selection.PasteSpecial Paste:=xlPasteFormulas
Cells(b, 7).Select
End If
Next
endo:
End Sub
vielleicht kannst du mir helfen??
danke, clemens