Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
152to156
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
152to156
152to156
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

Datenübernahme Textfeld leer

Datenübernahme Textfeld leer
24.08.2002 08:29:11
Peter Knierim
Hallo

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

2
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
Re: Datenübernahme Textfeld leer
24.08.2002 10:22:06
Bonte
Füge die Zeile On Error Resume Next vor der Zeile, die den Fehler liefert, ein. Mehr zur Fehlerbehandlung siehe online-Hilfe.

Gruß
Bonte

Re: Datenübernahme Textfeld leer
24.08.2002 15:41:15
Peter Knierim

Hallo,
entweder verstehe ich es nicht aber so funktioniert es nicht.
In der Tabelle wird der Wert 12:00:00 AM bei leerem Textfeld zurückgeschrieben.
Die eingetragen Datumswerte werden als Datum geschrieben.Können aber nicht mit autofüllen gezogen werden Beispiel 24.08.02 autoausfüllen müsste der nächste Tag erscheinen bleibt aber der 24.08.02.


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)
On Error Resume Next
Datum12 = CDate(Textbox2)
On Error Resume Next
Datum13 = CDate(Textbox3)
On Error Resume Next
Datum14 = CDate(Textbox4)
On Error Resume Next
Datum15 = CDate(Textbox5)
On Error Resume Next
Datum16 = CDate(Textbox6)
On Error Resume Next
Datum17 = CDate(Textbox7)
On Error Resume Next
Datum18 = CDate(Textbox9)
On Error Resume Next
Datum19 = CDate(txtFirmenaufmaß)
On Error Resume Next
Datum20 = CDate(txtFirma)
On Error Resume Next
Datum21 = CDate(txtSAPAbruf2)
On Error Resume Next
Datum22 = CDate(txtListesoll)
On Error Resume Next
Datum23 = CDate(txtEingangQNMMNS)
On Error Resume Next
Datum24 = CDate(txtUmschaltungbis)
On Error Resume Next
Datum25 = CDate(txtUmschaltungist)
On Error Resume Next

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 = Datum11
ActiveCell.Offset(0, 14).Value = Datum12
ActiveCell.Offset(0, 15).Value = Datum13
ActiveCell.Offset(0, 16).Value = Datum14
ActiveCell.Offset(0, 17).Value = Datum15
ActiveCell.Offset(0, 18).Value = Datum16
ActiveCell.Offset(0, 12).Value = Datum17
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 = Datun18
ActiveCell.Offset(0, 25).Value = Datum19
ActiveCell.Offset(0, 19).Value = Datum20
ActiveCell.Offset(0, 20).Value = Datum21
ActiveCell.Offset(0, 21).Value = Datum22
ActiveCell.Offset(0, 22).Value = Datum23
ActiveCell.Offset(0, 23).Value = Datum24
ActiveCell.Offset(0, 24).Value = Datum25
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


Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige