Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1680to1684
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
Inhaltsverzeichnis

kleine Hilfe bei User Form

kleine Hilfe bei User Form
21.03.2019 05:38:44
Thomas
Guten morgen,
wir haben ein User Form gebaut.
Leider haben wir paar Sachen drin, die Falsch sind und wir wissen nicht, wie wir das ändern sollen:
Problem 1 ist, das die Zahlen als Text gespeichert werden. Wie kann man es ändern, das es als Zahl gespeichert wird.z.b. 6,5
Problem 2 :
.Cells(92, intCol).Value = Txt_Arbeitszeitvon.Value
.Cells(93, intCol).Value = Txt_Arbeitszeitbis.Value
da ist schon mal die Vorgabe 17:00 und bei Arbeitszeit bis darf auch nur z.b 02:00 geschrieben werden. und alle beide als Uhrzeit speichern.
Problem 3 : Es darf nur eine 5 Stellige Zahl bei .Cells(94, intCol).Value = Txt_Menge_FD.Value eingetragen werden
Problem 4 Es kommt eine Abfrage. (If .Cells(113, intCol) 58 Then MsgBox "gesamt Mitarbeiter Perso ( 58 ) ist nicht korrekt, Bitte prüfen lassen!"
If .Cells(114, intCol) 7 Then MsgBox "gesamt Mitarbeiter Büro ( 7 ) ist nicht korrekt, Bitte prüfen lassen!" )
Wenn ein Fehler aufkommt kommt die Meldung aber danach wird es trotzdem gespeichert. Besser wäre es wenn die Fehlermeldung kommt und anschließend " Wollen sie es speichern oder prüfen "
Ich hoffe mir kann jemand helfen.
Danke
Private Sub Cmd_Speichern_Click()
Dim crt As Control
Dim intCol As Integer
Dim lngDatum As Long
lngDatum = CDate(TextBox55_datum)
Application.ScreenUpdating = False
With Workbooks("Tagesreport.xlsm").Sheets("2019")
If Not IsError(Application.Match(lngDatum, .Rows(1), 0)) Then
intCol = Application.Match(lngDatum, .Rows(1), 0)
.Cells(55, intCol).Value = TextBox44_user.Value
.Cells(56, intCol).Value = Format(CDate(TextBox66_zeit.Value), "hh:mm")
.Cells(57, intCol).Value = Txt_Bürospät.Value
.Cells(58, intCol).Value = Txt_Bürospät_Krank.Value
.Cells(59, intCol).Value = Txt_Bürospät_Urlaub.Value
.Cells(60, intCol).Value = Txt_Bürospät_Frei.Value
.Cells(61, intCol).Value = Txt_Bürospät_Ausgleich.Value
.Cells(62, intCol).Value = Txt_Bürospät_BR.Value
.Cells(63, intCol).Value = Txt_Bürospät_NT.Value
.Cells(64, intCol).Value = Txt_Bürospät_zu_Perso.Value
.Cells(65, intCol).Value = Txt_Bürospät_Perso_zu_Büro.Value
.Cells(66, intCol).Value = Txt_Bürospät_Sonstiges.Value
.Cells(76, intCol).Value = Txt_Perso.Value
.Cells(77, intCol).Value = Txt_Perso_Krank.Value
.Cells(78, intCol).Value = Txt_Perso_Urlaub.Value
.Cells(79, intCol).Value = Txt_Perso_Frei.Value
.Cells(80, intCol).Value = Txt_Perso_Ausgleich.Value
.Cells(81, intCol).Value = Txt_Perso_BR.Value
.Cells(82, intCol).Value = Txt_Perso_NT.Value
.Cells(83, intCol).Value = Txt_Perso_nach_TS.Value
.Cells(84, intCol).Value = Txt_Perso_von_TS.Value
.Cells(85, intCol).Value = Txt_Perso_Sonstige.Value
.Cells(92, intCol).Value = Txt_Arbeitszeitvon.Value
.Cells(93, intCol).Value = Txt_Arbeitszeitbis.Value
.Cells(94, intCol).Value = Txt_Menge_FD.Value
.Cells(95, intCol).Value = Txt_Menge_Obst.Value
.Cells(99, intCol).Value = Txt_Nachschub_Spät.Value
.Cells(100, intCol).Value = Txt_Wareneingang_Obst.Value
.Cells(101, intCol).Value = Txt_Nachschlicher.Value
.Cells(102, intCol).Value = Txt_Nachschlichter_Menge.Value
.Cells(103, intCol).Value = Txt_NachschlichterSTD.Value
.Cells(104, intCol).Value = Txt_Info_spät.Value
If .Cells(113, intCol)  58 Then MsgBox "gesamt Mitarbeiter Perso ( 58 ) ist nicht  _
korrekt, Bitte prüfen lassen!"
If .Cells(114, intCol)  7 Then MsgBox "gesamt Mitarbeiter Büro ( 7 ) ist nicht  _
korrekt, Bitte prüfen lassen!"
Else
MsgBox "falsches Datum"
With TextBox55_datum
.SetFocus
.SelStart = 0
.SelLength = Len(.Text)
End With
Exit Sub
End If
End With
MsgBox "Daten wurden in die Datenbank gespeichert !!!", , "Rückantwort -> Datenbank"
With Workbooks("Tagesreport .xlsm")
.Save
'.Close
End With
Application.ScreenUpdating = True
For Each crt In Me.Controls
Select Case TypeName(crt)
Case "TextBox"
crt.Value = ""
Case Else
End Select
Next
End Sub

8
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: kleine Hilfe bei User Form
21.03.2019 05:45:48
Hajo_Zi
Problem 1
=Cint(Textbox1) Ganze Zahl oder Cdbl.
Problem 2 ich baue keine Datei nach.
Problem 3 Eigenschaft Max...
Problem 4 siehe Problem 2

Beiträge von Werner, Luc, robert, J.O.Maximo und folgende lese ich nicht.
Die Beiträge werden auch ignoriert, es erfolgt keine Antwort.
nicht mal um die Zeit hat man Ruhe davon. o.w.T.
21.03.2019 06:39:06
Werner
AW: kleine Hilfe bei User Form
21.03.2019 09:46:10
snb

For Each it In Controls
If TypeName(it)="TextBox" Then it.Text = ""
Next

AW: kleine Hilfe bei User Form
21.03.2019 06:38:00
Werner
Hallo Thomas,
Problem 1:
.Cells(94, intCol).Value = CLng(Me.Txt_Menge_FD)
.Cells(95, intCol).Value = CLng(Txt_Menge_Obst)
Problem 2:
.Cells(92, intCol).Value = CDate(Me.Txt_Arbeitszeitvon)
.Cells(93, intCol).Value = CDate(Me.Txt_Arbeitszeitbis)
Problem 3:
If Len(Me.Txt_Menge_FD) = 5 Then
If IsNumeric(Me.Txt_Menge_FD) Then
.Cells(94, intCol).Value = CLng(Me.Txt_Menge_FD)
Else
Me.Txt_Menge_FD.SetFocus
Me.Txt_Menge_FD.SelStart = 0
Me.Txt_Menge_FD.SelLength = Len(Me.Txt_Menge_FD)
MsgBox "Nur Zahlenwerte zulässig."
Exit Sub
End If
Else
Me.Txt_Menge_FD.SetFocus
Me.Txt_Menge_FD.SelStart = 0
Me.Txt_Menge_FD.SelLength = Len(Me.Txt_Menge_FD)
MsgBox "nicht 5-stellig"
Exit Sub
End If

Dann die Textbox in den Eingenschaften bei MaxLength noch auf 5 einstellen.
Problem 4:
If Cells(113, intCol)  58 Then
If MsgBox("gesamt Mitarbeiter Perso ( 58 ) ist nicht korrekt. Bitte prüfen lassen!" _
& vbLf & vbLf & "Wollen Sie dennoch speichern?", vbYesNo, "Hinweis") = vbNo Then Exit Sub
End If
Gruß Werner
Anzeige
AW: kleine Hilfe bei User Form
21.03.2019 07:52:54
Thomas
Hallo Werner,
danke für diene Hilfe, passt alles soweit... WAHNSINN :-)
Nur ein Problem jetzt: Wenn z.b. ein Feld nicht ausgefüllt wird, kommt anschliesend Debuggen Fehler.
Wie kann ich das verhindern?
Kann man einbauen das es dann heißt " Eintrag bei ..... Fehlt , bitte eintragen. "
AW: kleine Hilfe bei User Form
21.03.2019 08:19:28
Werner
Hallo Thomas,
dann halt noch eine Prüfung auf leer, um die entsprechenden Textboxen, nach dem Muster:
If Me.Txt_Menge_FD  "" Then
.Cells(94, intCol).Value = CLng(Me.Txt_Menge_FD)
Else
MsgBox "Bitte Daten erfassen."
Me.Txt_Menge_FD.SetFocus
Exit Sub
End If
Gruß Werner
Anzeige
Danke für alles
21.03.2019 08:31:48
Thomas
.
Gerne u. Danke für die Rückmeldung. o.w.T.
21.03.2019 08:37:17
Werner

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige