| 
    
     |  | かみちゃんさんへ 過去ログからいろいろ調べました
 問題ないですか?
 よろしくお願いします
 Option Explicit
 
 Private Sub Worksheet_Change(ByVal Target As Range)
 If Intersect(Target, Range("D5:E50")) Is Nothing Then Exit Sub
 
 With Target
 If .Count > 1 Then Exit Sub
 If IsEmpty(.Value) Then Exit Sub
 If Not IsNumeric(.Value) Then Exit Sub
 
 If Len(.Value) <> 3 And Len(.Value) <> 4 Then
 MsgBox "値が違います"
 End If
 
 If .Value / 100 > 23 Then
 MsgBox "値が違います"
 End If
 
 If .Value Mod 100 > 59 Then
 MsgBox "値が違います"
 End If
 End With
 Application.EnableEvents = False
 On Error Resume Next
 Target.Value = Format(Target.Value, "00:00")
 On Error GoTo 0
 Application.EnableEvents = True
 End Sub
 
 
 |  |