Ich habe ein Listbox die mir die Spalten A-G von Zeile 7-11 anzeigt und zwei Textboxen. Wenn ich die Zeile 11 was in Listbox Zeile 5 ist auswähle und einen Wert in Textbox reinschreiben möchte, möchte ich das es in die Spalte H Zeile 11 reinschreibt, aber leider funktioniert das nicht so wie ich es möchte.
Mein Code :
Private Sub CommandButton1_Click()
With Wareneingang.ListBox1
For i = 0 To .ListCount - 1
If .Selected(i) Then
Cells(i + 1, 8) = TextBox1.Text
Cells(i + 1, 9) = TextBox2.Text
End If
Next i
End With
ActiveWorkbook.Save
MsgBox "Wagennr hinzugefügt"
Unload Me
End Sub
Cells(CBool(.List(i, 0)) + 1, 8) = TextBox1.Text
Cells(CBool(.List(i, 0)) + 1, 9) = TextBox2.Text
oder
Cells(CStr(.List(i, 0)) + 1, 8) = TextBox1.Text
Cells(CStr(.List(i, 0)) + 1, 9) = TextBox2.Text
funktionieren auch nicht