ich suche nach einer Möglichkeit die Werte einer Listbox in eine einzige Zelle zu Schreiben.
Beispiel:
Listbox 1
Apfel
Zitrone
Birne
Cmb_Übernehmen_Click()
A1 = Apfel / Zitrone / Birne
Kann mir da jemand weiter helfen?
Danke und Gruß
Robert
Sheets("DeineTabelle").Cells(nRow, 14) = Join(ListBox_Q1.List, " / ")
Sheets("DeineTabelle").Cells(nRow, 15) = Join(ListBox_P1.List, " / ")
Gruß WernerSub Test_abschliessen()
Dim Datum As Date
If MsgBox("Ist der Test abgeschlossen?", vbYesNo + vbQuestion, "Frage") = vbNo Then Exit Sub
If bolEingabeMoeglich Then
Datum = CDate(txt_Datum)
Sheets("Test").Activate
End If
With Sheets("Test")
.Cells(nRow, "A") = txt_Laufendenummer
.Cells(nRow, "B") = txt_User
.Cells(nRow, "C") = txt_Datum
.Cells(nRow, "D") = txt_Startzeit
.Cells(nRow, "E") = Time
Range("F2:F" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("F2"). _
FormulaR1C1
.Cells(nRow, "G") = cb_Linie
.Cells(nRow, "H") = txt_Scannercode
.Cells(nRow, "I") = "x"
.Cells(nRow, "J") = ""
.Cells(nRow, "K") = txt_Kombinationstyp
.Cells(nRow, "L") = ""
.Cells(nRow, "M") = Trim(txt_Bemerkungen)
Sheets("Test").Cells(nRow, "14") = Join(ListBox_Q1.List, " / ")
Sheets("Test").Cells(nRow, "15") = Join(ListBox_P1.List, " / ")
If Me.ListBox_Q1.ListCount > 0 Then Sheets("Q1 + P1").Cells(Rows.Count, 1).End(xlUp). _
Offset(1, 0).Resize(Me.ListBox_Q1.ListCount, Me.ListBox_Q1.ColumnCount) = Me.ListBox_Q1.List
If Me.ListBox_P1.ListCount > 0 Then Sheets("Q1 + P1").Cells(Rows.Count, 6).End(xlUp). _
Offset(1, 0).Resize(Me.ListBox_P1.ListCount, Me.ListBox_P1.ColumnCount) = Me.ListBox_P1.List
ActiveWorkbook.Save
txt_Scannercode.SetFocus
End With
Call ClearAllTxtFields
Call NewRow
ListBox_1.Clear
ListBox_2.Clear
ListBox_3.Clear
ListBox_4.Clear
ListBox_5.Clear
ListBox_P2.Clear
ListBox_B1.Clear
ListBox_Q1.Clear
ListBox_P1.Clear
End Sub
nRow hat einen Zahlenwert (1,2,3 usw) als Laufende NummerFunction ListString(lbx As Object) As String
Dim i As Integer, s As String
For i = 0 To ListBox1.ListCount - 1
s = s & " / " & lbx.List(i)
Next
ListString = Mid(s, 4)
End Function