View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
NoodNutt[_2_] NoodNutt[_2_] is offline
external usenet poster
 
Posts: 39
Default Converting Numeral to Time equivalent

Hi Claus

Much appreciation for this. Alas it did not work though. I actually used something similar to this earlier in the day, which garnered the same outcome.
It's not triggering the cell change.

Even with the cells formatted as numbers, and entering say, 515, it stays as 515.

I also noticed you copied the Case section from earlier as it contained Case 3 & 4 which should have reflected Case 10 & 11. So this is what I ended up with.

Also, the NumberFormat is [h]:mm as I am directly calculating the cells as numbers.

If Not Intersect(Target, Range("C3:C43")) Is Nothing Then
If Target.Cells.Count 1 Then Exit Sub

Select Case Target.Column
Case 3
If Target.Value = "YARD" Or Target.Value = "C0654" Then
Target.Offset(0, 7).Select
Else
Target.Offset(0, 1).Select
End If
Case 8
Target.Offset(0, 2).Select
Case 10, 11
If IsNumeric(Target) And Target <= 2800 Then
Select Case Len(Target)
Case 10
Target = TimeValue(Left(Target, 1) & ":" & Right(Target, 2))
Target.Offset(0, 1).Select
Case 11
Target = TimeValue(Left(Target, 2) & ":" & Right(Target, 2))
End Select
Target.NumberFormat = "[h]:mm"
End If
End Select
End If