Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The code below is designed to change a number input, such as 1425 to 14:25. Is there anything I can do prevent the code from running if the number is already properly inputted? Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range) Dim e ActiveSheet.Unprotect On Error GoTo ErrorHandler If Not Application.Intersect(Target, Range("E3:E8000")) Is Nothing Then If ActiveCell < "" Then GoTo ErrorHandler e = Left(Format(Target.Value, "0000"), 4) Application.EnableEvents = False Target.Formula = Left(e, 2) & ":" & Right(e, 2) End If Application.EnableEvents = True If ActiveCell = ":" Then GoTo ClearCell Exit Sub ClearCell: Selection.ClearContents Exit Sub ErrorHandler: Exit Sub: End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
IF - And - Then Statement question | Excel Worksheet Functions | |||
IF Statement question | Excel Discussion (Misc queries) | |||
IF statement question | Excel Worksheet Functions | |||
IF Statement Question | Excel Worksheet Functions | |||
IF Statement question | Excel Worksheet Functions |