ich finde leider nichts passendes im Archiv.
Mittels diesem Code lade ich die ComboBox1:
Dim xRow&
xRow = wksTB1.[A65536].End(xlUp).Row
With ComboBox1
.Clear
.RowSource = "Tabelle1!A3:D" & xRow
.ColumnCount = 4
.ColumnWidths = "50;50;40;40"
.Text = "neue Buchung hinzufügen"
End With
Wenn ich jetzt einen Eintrag in ComboBox1 auswähle, möchte ich den gewählten Datensatz in die TextBox/ComboBox übertragen.Ich verwende folgenden Code, der aber nicht funktioniert:
Private Sub ComboBox1_Change()
If ComboBox1.ListIndex = -1 Then
Label37.Visible = True
Label37.Caption = "kein Eintrag ausgewählt"
ComboBox1.Value = "neue Buchung hinzufügen"
ElseIf ComboBox1.ListIndex > -1 Then
ComboBox1.Value = CDate(ComboBox1.Value)
'' TextBox1.Value = CDate(ComboBox1.Column(0, ComboBox1.ListIndex + 1))
'' ComboBox2.Value = ComboBox1.Column(1, ComboBox1.ListIndex + 1)
'' ComboBox3.Value = Format(ComboBox1.Column(2, ComboBox1.ListIndex + 1), "#0.00")
'' TextBox4.Value = ComboBox1.Column(3, ComboBox1.ListIndex + 1)
''End If
With Me
TextBox1 = (Cells(ComboBox1.ListIndex + 1, 1))
ComboBox2 = Cells(ComboBox1.ListIndex + 1, 2)
ComboBox3 = Format(Cells(ComboBox1.ListIndex + 1, 3), "#0.00")
TextBox4 = Cells(ComboBox1.ListIndex + 1, 4)
End With
End If
End Sub
Was mache ich hier bitte falsch?Gruss
Peter