Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
'change target range to suit
If Not Intersect(Target, Columns("P")) Is Nothing Then
For Each c In Intersect(Target, Columns("P"))
If IsNumeric(c.Value) And c.Value Like "?#.##" Then
Application.EnableEvents = False
c.Value = Int(c.Value) & ":" & Right(c.Value, 2)
Application.EnableEvents = True
End If
Next c
End If
End Sub
TimeStr = CStr(ActiveCell.Value)
hrs = Left(TimeStr, InStr(1, TimeStr, ".") - 1)
mins = Mid(TimeStr, InStr(1, TimeStr, ".") + 1, 2)
TimeVal = hrs / 24 + mins / 24 / 60
ActiveCell.NumberFormat = "h:mm;@"
ActiveCell.Value = TimeVal
TimeVal_0 = ActiveCell.Value
hrs = Int(TimeVal_0)
mins = (TimeVal_0 - Int(TimeVal_0)) * 100
TimeVal = hrs / 24 + mins / 24 / 60
.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
' Adapt Column Input to your situation '
If Target.Column <> 1 Then Exit Sub
If Target = "" Then Exit Sub
Application.EnableEvents = False
Application.ScreenUpdating = False
With Target
.Offset(0, Range("IV2").End(xlToLeft).Offset(0, 1).Row).Value2 = _
(Int(.Value2) / 24) + ((.Value2 - Int(.Value2)) * 100) / 1440
.Value2 = .Offset(0, Range("IV2").End(xlToLeft).Offset(0, 1).Row).Value2
.NumberFormat = "hh:mm"
.Offset(0, Range("IV2").End(xlToLeft).Offset(0, 1).Row).Clear
End With
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub