Office-Fragen.de
Uhrzeit mit vba - Druckversion

+- Office-Fragen.de (https://office-fragen.de)
+-- Forum: Microsoft Office (https://office-fragen.de/forum-1.html)
+--- Forum: Excel (https://office-fragen.de/forum-2.html)
+--- Thema: Uhrzeit mit vba (/thread-29337.html)



Uhrzeit mit vba - Thomasius - 29.08.2026

Hallo schönen guten Tag
sorry das ich das nochmal anspreche
die VBA hat immer super geklappt seit letztens geht es nicht mehr , das ich 730 schreibe und 7:30 erscheint
nun muss ich 73000 eingeben das 7:30 erscheint , oder 153000 das 15:30 erscheint. Also immer 00 anhängen war doch vorher nicht so, woran kann das liegen ihr Lieben ???




Private Sub Worksheet_Change(ByVal Target As Range)
Dim loA As Long
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("F37,F43,C5:e35")) Is Nothing Then
    If Target = "" Then Exit Sub
        Application.EnableEvents = False
            If Not IsNumeric(Target) Then
                If Target.Column <> 3 Then
                    response = MsgBox("Eingabefehler! Nur Zahlen erlaubt!", vbOKOnly, "Achtung")
                    Target = ""
                Else
                    Target = UCase(Target)
                End If
            Else
                Target = CStr(Target)
                loA = Len(Target)
                Target = Left(Format(Target, "0000"), 2) & ":" & Right(Target, 2)
                Target.NumberFormat = "[h]:mm"
            End If
            Application.EnableEvents = True
End If

If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("f44")) Is Nothing Then
    If Target = "" Then Exit Sub
        Application.EnableEvents = False
            If Not IsNumeric(Target) Then
                If Target.Column <> 3 Then
                    response = MsgBox("Eingabefehler! Nur Zahlen erlaubt!", vbOKOnly, "Achtung")
                    Target = ""
                Else
                    Target = UCase(Target)
                End If
            Else
                Target = CStr(Target)
                loA = Len(Target)
                Target = Left(Format(Target, "00000"), 3) & ":" & Right(Target, 2)
                Target.NumberFormat = "[h]:mm"
            End If
            Application.EnableEvents = True
End If
If Not Intersect(Target, Range("E5:E34")) Is Nothing Then
        Target.Offset(1, -2).Activate
    End If


End Sub


RE: Uhrzeit mit vba - Calderon - 30.08.2026

Ist in den Excel Optionen "Dezimalstelle automatisch einfügen" aktiviert? Dann deaktivieren.


RE: Uhrzeit mit vba - Thomasius - 30.08.2026

Das war es Danke
Gruß Thomas