AW: Zeiterfassung per Button
01.02.2024 11:11:38
Alwin Weisangler
Hallo,
wenn du es mit Buttons machen willst, kann man auf den Timer verzichten. Dann würde es so reichen (allgemeines Modul):
Option Explicit
Sub KommtEins()
KommtGeht 1, 0
End Sub
Sub GehtEins()
KommtGeht 0, 1
End Sub
Sub KommtZwei()
KommtGeht 2, 0
End Sub
Sub GehtZwei()
KommtGeht 0, 2
End Sub
Private Sub KommtGeht(k As Long, g As Long)
With Sheets(Format(Date, "mmmm"))
If k = 1 And .Cells(Format(Date, "d") + 3, 4) = "" Then .Cells(Format(Date, "d") + 3, 4) = Format(Now, "hh:mm")
If g = 1 And .Cells(Format(Date, "d") + 3, 5) = "" Then .Cells(Format(Date, "d") + 3, 5) = Format(Now, "hh:mm")
If k = 2 And .Cells(Format(Date, "d") + 3, 6) = "" Then .Cells(Format(Date, "d") + 3, 6) = Format(Now, "hh:mm")
If g = 2 And .Cells(Format(Date, "d") + 3, 7) = "" Then .Cells(Format(Date, "d") + 3, 7) = Format(Now, "hh:mm")
End With
End Sub
Gruß Uwe