1.3k Aufrufe
Gefragt in Tabellenkalkulation von
hallo,

ich habe eine Listbox mit 7 spalten
wenn ich auf eins der datensätze klicke, würde ich gerne dass der ausgewählte datensatz in die textboxe 1 bis 7 übertragen wird.

scheitere momentan an folgender stelle..

For i = 1 To 7
boxnummer = 30 + i
UserForm1.Controls(TextBox & boxnummer).Text = UserForm1.ListBox2.List(iRow, i).Text

Next i

vielen Dank für die unterstützung

1 Antwort

0 Punkte
Beantwortet von hajo_zi Experte (9.1k Punkte)
Hallo,

Private Sub ListBox1_Change()
If ListBox1.Tag <> "" Then Exit Sub
TextBox1 = ListBox1.List(ListBox1.ListIndex, 0)
TextBox2 = ListBox1.List(ListBox1.ListIndex, 1)
TextBox3 = ListBox1.List(ListBox1.ListIndex, 2)
TextBox4 = ListBox1.List(ListBox1.ListIndex, 3)
TextBox5 = ListBox1.List(ListBox1.ListIndex, 4)
TextBox6 = ListBox1.List(ListBox1.ListIndex, 5)
TextBox7 = ListBox1.List(ListBox1.ListIndex, 6)
End Sub

Gruß Hajo
...