kleine Hilfe bei User Form
21.03.2019 05:38:44
Thomas
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