Brian from Maui
MrExcel MVP
- Joined
- Feb 16, 2002
- Messages
- 8,459
Trying to revise a code to automatically add a colon and decimal point.
Cell is Custom Formatted as [mm]:ss.00
Want to just enter six digits and the colon and decimal point would be added with the code.
Obviuosly not not working. Can someone correct this? TIA
Cell is Custom Formatted as [mm]:ss.00
Want to just enter six digits and the colon and decimal point would be added with the code.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("timeCells")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
With Target
If Len(Target) = 6 Then .Value = Left(.Value, 2) & ":" & Mid(.Value, 2) & "." & Right(.Value, 2)
Application.EnableEvents = True
End With
End Sub
Obviuosly not not working. Can someone correct this? TIA