View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Sandy Mann Sandy Mann is offline
external usenet poster
 
Posts: 2,345
Default Correcting time input by users

Better make that:

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Intersect(Target, Range("F:F")) Is Nothing Then Exit Sub
If Target.Cells.Count 1 Then Exit Sub

If IsNumeric(Target) Then Exit Sub

On Error GoTo GetOut

Application.EnableEvents = False

If Right(UCase(Target.Value), 2) = "AM" Then _
Target.Value = Left(Target.Value, Len(Target.Value) - 2) & " AM"

If Right(UCase(Target.Value), 2) = "PM" Then _
Target.Value = Left(Target.Value, Len(Target.Value) - 2) & " PM"
GetOut:
Application.EnableEvents = True
End Sub

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"Greg H." wrote in message
...
I have a worksheet where employees will be entering in times. I do
caculations based on these times and I would like a way so if the user
enters
inthe time like "10:00pm" that excel will correct it to display "10:00
pm".
Is there a way to check for this?