ich hoffe ihr könnt mir nochmal helfen.
Mit den folgenden Marko übernehme ich aus einem Userform die Daten aus den Textboxen in eine Tabelle.Aber nicht alle Textboxen
haben gleich einen Eintrag.Wenn z.B. Textbox5 oder Textbox7 später erst eingetragen werden kann, bleiben die Textboxen bei Ersteingabe leer und sollen auch leer übernommen werden.
Da aber mit Fotrmat CDate übernommen werden muß´und die textbox leer ist bekomme ich eine Fehlermeldung ist auch richtig.
Möchte aber das mein Marko läuft
vielen Dank im voraus
mfg
Peter
Private Sub CommandButton4_Click()
Dim Datum11 As Date
Dim Datum12 As Date
Dim Datum13 As Date
Dim Datum14 As Date
Dim Datum15 As Date
Dim Datum16 As Date
Dim Datum17 As Date
Dim Datum18 As Date
Dim Datum19 As Date
Dim Datum20 As Date
Dim Datum21 As Date
Dim Datum22 As Date
Dim Datum23 As Date
Dim Datum24 As Date
Dim Datum25 As Date
Datum11 = CDate(Textbox1)
Datum12 = CDate(Textbox2)
Datum13 = CDate(Textbox3)
Datum14 = CDate(Textbox4)
Datum15 = CDate(Textbox5)
Datum16 = CDate(Textbox6)
Datum17 = CDate(Textbox7)
Datum18 = CDate(Textbox9)
Datum19 = CDate(txtFirmenaufmaß)
Datum20 = CDate(txtFirma)
Datum21 = CDate(txtSAPAbruf2)
Datum22 = CDate(txtListesoll)
Datum23 = CDate(txtEingangQNMMNS)
Datum24 = CDate(txtUmschaltungbis)
Datum25 = CDate(txtUmschaltungist)
Set frm = UserForm
Sheets("Betriebsaufträge").Activate
'letzte belegte Zelle in Tabelle finden
Range("A65536").End(xlUp).Offset(1, 0).Select
With frm
ActiveCell.Value = .txtLNr.Value
ActiveCell.Offset(0, 13).Value = .Textbox1.Value
ActiveCell.Offset(0, 14).Value = .Textbox2.Value
ActiveCell.Offset(0, 15).Value = .Textbox3.Value
ActiveCell.Offset(0, 16).Value = .Textbox4.Value
ActiveCell.Offset(0, 17).Value = .Textbox5.Value
ActiveCell.Offset(0, 18).Value = .Textbox6.Value
ActiveCell.Offset(0, 12).Value = .Textbox7.Value
ActiveCell.Offset(0, 5).Value = .ComboBox2.Value
ActiveCell.Offset(0, 6).Value = .ccbOrt.Value
ActiveCell.Offset(0, 8).Value = .ccbVSTKr.Value
ActiveCell.Offset(0, 9).Value = .ccbSystem.Value
ActiveCell.Offset(0, 7).Value = .ccbBeschreibung.Value
ActiveCell.Offset(0, 10).Value = .Textbox9.Value
ActiveCell.Offset(0, 25).Value = .txtFirmenaufmaß.Value
ActiveCell.Offset(0, 19).Value = .txtFirma.Value
ActiveCell.Offset(0, 20).Value = .txtSAPAbruf2.Value
ActiveCell.Offset(0, 21).Value = .txtListesoll.Value
ActiveCell.Offset(0, 22).Value = .txtEingangQNMMNS.Value
ActiveCell.Offset(0, 23).Value = .txtUmschaltungbis.Value
ActiveCell.Offset(0, 24).Value = .txtUmschaltungist.Value
ActiveCell.Offset(0, 26).Value = .ccbAufbauleiter.Value
ActiveCell.Offset(0, 11).Value = .ccbPlaner.Value
If OptionButton1 = True Then
ActiveCell.Offset(0, 1).Value = "x"
End If
If OptionButton2 = True Then
ActiveCell.Offset(0, 2).Value = "x"
End If
If OptionButton3 = True Then
ActiveCell.Offset(0, 3).Value = "x"
End If
If OptionButton4 = True Then
ActiveCell.Offset(0, 4).Value = "x"
End If
.txtLNr.SetFocus
End With
Mldg = "Daten in die Tabelle übernommen"
Stil = vbOKOnly + vbInformation + vbDefaultButton2
Title = "Auftragsverwaltung"
Kontext = 1000
Ergebnis = MsgBox(Mldg, Stil, Title, Help, Kontext)
Unload Me
End Sub