ich befülle mit Userform_Initialize die ComboBox3 mit folgendem Code:
Auszug:
Dim avntValues As Variant 'benötigt für ComboBox3
Dim ialngIndex As Long 'benötigt für ComboBox3
With Worksheets("Berechnungstabelle")
avntValues = .Range(.Cells(2, 1), .Cells( _
.Cells(.Rows.Count, 1).End(xlUp).Row, 14)).Value2
End With
With ComboBox3
For ialngIndex = 1 To UBound(avntValues)
If avntValues(ialngIndex, 1) > "0" Then 'zeigt nur die Werte an die über "0" _
sind - "" zeigt alle Werte an
Call .AddItem(Format(avntValues(ialngIndex, 1), "#0.00"))
.List(.ListCount - 1, 1) = Format(avntValues(ialngIndex, 14), "0")
End If
Next
End With
Wenn ich jetzt einen neuen Datensatz in die Tabelle1 einfüge, soll in der Userform die ComboBox3 neu befüllt werden mit den geänderten Werten.Sub ComboBox3_fuellen()
Dim avntValues As Variant 'benötigt für ComboBox3
Dim ialngIndex As Long 'benötigt für ComboBox3
With Worksheets("Berechnungstabelle")
avntValues = .Range(.Cells(2, 1), .Cells( _
.Cells(.Rows.Count, 1).End(xlUp).Row, 14)).Value2
End With
With ComboBox3
For ialngIndex = 1 To UBound(avntValues)
If avntValues(ialngIndex, 1) > "0" Then 'zeigt nur die Werte an die über "0" sind - "" zeigt alle Werte an
Call .AddItem(Format(avntValues(ialngIndex, 1), "#0.00"))
.List(.ListCount - 1, 1) = Format(avntValues(ialngIndex, 14), "0")
End If
Next
End With
End Sub
Wenn ich den o.a. Code in einen seperaten Code einfüge und im CommandButton am Ende Call ComboBox3_befüllen dann wird dies nicht ausgeführt.
Könnt ihr mir bitte helfen.
Gruss
Peter