ich benutze im Moment folgenden Code um eine Listbox auszulesen.
Sub cmd_Uebernehmen_Click()
Dim Datum As Date
If MsgBox("Ist die Prüfung abgeschlossen?", vbYesNo + vbQuestion, "Frage") = vbNo Then Exit _
Sub
If bolEingabeMoeglich Then
Datum = CDate(txt_date)
Prüfung_abschließen
End If
With Sheets("Prüfung")
.Cells(nRow, "A") = nRow - 1
.Cells(nRow, "B") = txt_uhr
.Cells(nRow, "C") = txt_Temperatur
.Cells(nRow, "D") = txt_date
.Cells(nRow, "E") = txt_Timer
.Cells(nRow, "F") = Trim(txt_BoxID)
.Cells(nRow, "G") = IIf(cmb_Einheit.ListIndex >= 0, cmb_Einheit.Text, "")
.Cells(nRow, "H") = txt_prüfer
.Cells(nRow, "I") = txt_Rezeptur
.Cells(nRow, "J") = CheckBox1
.Cells(nRow, "K") = CheckBox2
.Cells(nRow, "L") = CheckBox3
.Cells(nRow, "M") = CheckBox4
.Cells(nRow, "N") = CheckBox5
.Cells(nRow, "O") = CheckBox6
.Cells(nRow, "P") = CheckBox7
.Cells(nRow, "Q") = CheckBox8
.Cells(nRow, "R") = CheckBox9
.Cells(nRow, "S") = Pick1
.Cells(nRow, "T") = Pick2
.Cells(nRow, "U") = Pick3
.Cells(nRow, "V") = Pick4
.Cells(nRow, "W") = Pick5
.Cells(nRow, "X") = Pick6
.Cells(nRow, "Y") = Pick7
.Cells(nRow, "Z") = Pick8
.Cells(nRow, "AA") = Pick9
.Cells(nRow, "AB") = Pick10
.Cells(nRow, "AC") = Pick11
.Cells(nRow, "AD") = Pick12
.Cells(nRow, "AE") = Trim(txt_Bemerkungen)
.Cells(nRow, "BC") = txt_pickcount
.Cells(nRow, "BD") = txt_moprocount
.Cells(nRow, "BE") = txt_gewürzecount
.Cells(nRow, "BF") = txt_rezeptcount
Range("AF3:AF" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AF2"). _
FormulaR1C1
Range("AG3:AG" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AG2"). _
FormulaR1C1
Range("AH3:AH" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AH2"). _
FormulaR1C1
Range("AI3:AI" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AI2"). _
FormulaR1C1
Range("AJ3:AJ" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AJ2"). _
FormulaR1C1
Range("AK3:AK" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AK2"). _
FormulaR1C1
Range("AL3:AL" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AL2"). _
FormulaR1C1
Range("AM3:AM" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AM2"). _
FormulaR1C1
Range("AN3:AN" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AN2"). _
FormulaR1C1
Range("AO3:AO" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AO2"). _
FormulaR1C1
Range("AP3:AP" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AP2"). _
FormulaR1C1
Range("AQ3:AQ" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AQ2"). _
FormulaR1C1
Range("AR3:AR" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AR2"). _
FormulaR1C1
Range("AS3:AS" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AS2"). _
FormulaR1C1
Range("AT3:AT" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AT2"). _
FormulaR1C1
Range("AU3:AU" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AU2"). _
FormulaR1C1
Range("AV3:AV" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AV2"). _
FormulaR1C1
Range("AW3:AW" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AW2"). _
FormulaR1C1
Range("AX3:AX" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AX2"). _
FormulaR1C1
Range("AY3:AY" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AY2"). _
FormulaR1C1
Range("AZ3:AZ" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("AZ2"). _
FormulaR1C1
Range("BA3:BA" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("BA2"). _
FormulaR1C1
Range("BB3:BB" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("BB2"). _
FormulaR1C1
Range("BG3:BG" & Cells(Rows.Count, 1).End(xlUp).Row).FormulaR1C1 = Range("BG2"). _
FormulaR1C1
frm_Eingabe.CheckBox1.Value = False
frm_Eingabe.CheckBox2.Value = False
frm_Eingabe.CheckBox3.Value = False
frm_Eingabe.CheckBox4.Value = False
frm_Eingabe.CheckBox5.Value = False
frm_Eingabe.CheckBox6.Value = False
frm_Eingabe.CheckBox7.Value = False
frm_Eingabe.CheckBox8.Value = False
frm_Eingabe.CheckBox9.Value = False
frm_Eingabe.Pick1.Value = False
frm_Eingabe.Pick2.Value = False
frm_Eingabe.Pick3.Value = False
frm_Eingabe.Pick4.Value = False
frm_Eingabe.Pick5.Value = False
frm_Eingabe.Pick6.Value = False
frm_Eingabe.Pick7.Value = False
frm_Eingabe.Pick8.Value = False
frm_Eingabe.Pick9.Value = False
frm_Eingabe.Pick10.Value = False
frm_Eingabe.Pick11.Value = False
frm_Eingabe.Pick12.Value = False
ListBox1.Clear
ActiveWorkbook.Save
txt_BoxID.SetFocus
Stopp
End With
With Sheets("Quality").Range("A2")
.Resize(Me.ListBox2.ListCount, Me.ListBox2.ColumnCount) = Me.ListBox2.List
End With
Call ClearAllTxtFields
Call NewRow
End Sub
Meine Frage betrifft den Part:
With Sheets("Quality").Range("A2")
.Resize(Me.ListBox2.ListCount, Me.ListBox2.ColumnCount) = Me.ListBox2.List
Ich möchte listbox 2 in das Sheet Quality auslesen (funktioniert auch) allerdings vortlaufend. Im Moment werden die Zuvor ausgelesenen Werte überschrieben. Desweitern habe ich auch das Problem das der Debugg anspringt wenn in Listbox2 nichts steht.
Könnte mir jemand eine schnelle Lösung für beide Probleme liefern? Ich benötige eine fortlaufende Erfassung immer in die letzte leere Zelle und das kein Fehler ausgegeben wird wenn Listbox2 keine Werte enthält.
Danke und Gruß
Robert