Column headers throws errors
The following code allows me to quickly enter time by converting the four digits to military time within Columns A & B. In testing I can enter any cell in Columns A and B and it works. However if I enter a column Header if causes the code to inaccurately enter values. Should I amend the code to include a row.count to overcome this issue.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rColumn As Integer
Dim OldInput As String
Dim NewInput As String
Dim rRow As Integer
rColumn = Target.Column
If rColumn < 3 Then
OldInput = Target.Value
If OldInput > 1 Then
NewInput = Left(OldInput, Len(OldInput) - 2) & ":" & Right(OldInput, 2)
Application.EnableEvents = False
Target = NewInput
Application.EnableEvents = True
End If
End If
End Sub