Excel: Error in Enableevents removing colon in military time


I have entered the following code in Excel 2013 Private Sub Worksheet_SelectionChange(ByVal Target As Range) UserInput = Target.Value If UserInput > 1 Then NewInput = Left(UserInput, Len(UserInput) - 2) & ":" & Right(UserInput, 2) Application.EnableEvents = False Target = NewInput Application.EnableEvents = True End If I am getting an error in "IF USERINPUT > 1 THEN". Can anyone help? Thanks!


This question generated 14 answers. To proceed to the answers, click here.

This thread is current as of October 02, 2014.


For more resources for Microsoft Excel