Converting Numeral to Time equivalent
NoodNutt wrote:
Was hoping someone was able to point me in the right direction please:
I am trying to speed up data entry by just entering a number and have in
auto-convert to time, eg 515 = 5:15 or 1415 = 14:15, reducing keystrokes
will significantly speed up this process in Columns( 10 & 11 ).
I tried inserting it into my Worksheet_Change event, but it will not
fire ( although it fires if I run the sub on it's own ).
I have this so far, so if anyone can point me in the right direction, I
will be super-grateful.
Just to add what's already been said, here's what Claus basically wrote for
me several years ago:
Sub fixTimes(what As Range)
Dim cell As Range
For Each cell In what
'fixed by Claus Busch
If (InStr(cell.Value, ".") < 1) And (IsNumeric(cell.Formula)) Then
Select Case cell.Formula
Case 0 To 2359
cell.Value = (CLng(cell.Formula) \ 100) & ":" & _
(CLng(cell.Formula) Mod 100)
End Select
End If
Next
End Sub
The only thing is, it assumes that you're entering valid times, not something
like "199".
--
"What do you fear, lady?" he asked.
"A cage," she said.
|