ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   convert time (https://www.excelbanter.com/excel-worksheet-functions/156477-convert-time.html)

ann

convert time
 
I need to be able to type in numbers and minutes very quickly, example 1 min
24 sec, and have it automatically convert it to all seconds. So if i type
in 1.24 it becomes 84.

Any thoughts. thanks!

Bob Phillips

convert time
 

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Value = Int(.Value) * 60 + (.Value - Int(.Value)) * 100
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"ann" wrote in message
...
I need to be able to type in numbers and minutes very quickly, example 1
min
24 sec, and have it automatically convert it to all seconds. So if i
type
in 1.24 it becomes 84.

Any thoughts. thanks!





All times are GMT +1. The time now is 02:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com