Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am attempting to set up an input mask for the active cell such that the
time can be entered as 3 or 4 digits without the full colon.(815 for 08:15 AM) In the sample code below, I never get to the numberformat property and the code sems to be recursively called from itself. I've tried both the Calculate and the Change events. What's my best solution? Thanks! Lee Private Sub Worksheet_Some_event(ByVal Target As Range Dim InTime As String Dim Apostrophe As String Apostrophe = "" If Len(Target) = 4 Then ' Allow 815 instead of 0815 InTime = Apostrophe & Left(Target.Value, 2) & ":" & Right(Target.Value, 2) & Apostrophe Else: InTime = Apostrophe & "0" & Left(Target.Value, 1) & ":" & Right(Target.Value, 2) & Apostrophe End If ActiveCell.Value = InTime ActiveCell.NumberFormat = "hh:mm A" End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Help - Can't directly input Japanese characters into cell | Excel Discussion (Misc queries) | |||
Delete cell contents with input to adjacent cell | Excel Discussion (Misc queries) | |||
How do I change the format of a cell based on what I input? | Excel Worksheet Functions | |||
cell color index comparison | New Users to Excel | |||
what is the format for an input cell? | Excel Discussion (Misc queries) |