Datenauslesen ListBox
24.03.2020 16:45:52
Hajo_Zi
Hallo,
ich stehe vor einem für mich unlösbaren Problem.
Ich habe eine UserForm mit ListBoxen (für einen MultiSelect) und ComboBoxen. Die getroffene Auswahl soll in Tabelle 1 dargestellt werden. Klappt solange wunderbar, wie ich jeweils nur eine Eigenschaft aus den ListBoxen auswähle. Wähle ich mehrere Eigenschaften aus, erscheint nur die zuletzt angeklickte.
Ich hoffe Ihr könnt mir hierbei helfen.
Private Sub cmdEingabe_Click()
'Erste Freie Zeile ausfindig machen
'Dimensionierung Variable
Dim i As Integer
Dim j As Integer
Dim Listauswahl_GlovePort_left As String
Dim Listauswahl_GlovePort_right As String
Dim spaltenstart_right As Integer
'Sicherheitsabfrage
Listauswahl_GlovePort_left = ""
Listauswahl_GlovePort_right = ""
Dim Test As String
Dim zeilenstart As Integer
Dim spaltenstart_left As Integer
Dim SpaltenZahl As Integer
zeilenstart = 4
spaltenstart_right = 3
'Lese Spalte
SpaltenZahl = frm_Field.TextBox1.Text
spaltenstart_right = spaltenstart_right + SpaltenZahl - 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ListBoxGlovePortleft.List(ListBoxGlovePortleft.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ListBoxGlovePortright.List(ListBoxGlovePortright.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ListBoxHandschuhposition_x.List(ListBoxHandschuhposition_x.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = ListBox2. _
List(ListBox2.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ComboBoxHandschuhposition_z.List(ComboBoxHandschuhposition_z.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ComboBoxHolmlaenge.List(ComboBoxHolmlaenge.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ComboBoxScheibengroesse_li.List(ComboBoxScheibengroesse_li.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = ComboBox3. _
List(ComboBox3.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ComboBoxSchulterringlage.List(ComboBoxSchulterringlage.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ComboBoxSicherheitsabfrage.List(ComboBoxSicherheitsabfrage.ListIndex)
zeilenstart = zeilenstart + 1
Sheets("Eingabe_Scheibendefinition").Cells(zeilenstart, spaltenstart_right).Value = _
ComboBoxWerkzeug.List(ComboBoxWerkzeug.ListIndex)
zeilenstart = 4
spaltenstart_left = 3
spaltenstart_right = 4
End Sub
Betrifft: AW: Datenauslesen ListBox
ich baue die Datei nicht nach.
For LoI = 0 To ListBox1.ListCount - 1
If ListBox1.Selected(LoI) Then
's = s & ListBox1.List(i)
' Beispiel nur Spalte 1
.Cells(LoLetzte + 1, 1) = ListBox1.List(LoI, 0)
LoLetzte = LoLetzte + 1
End If