-Edit- To use as an add-in
Excel Add-In: http://www.filedropper.com/mintohms
Create a class module named SheetChangeHandler with the following code:
Option Explicit
Private WithEvents App As Application
Private Sub Class_Initialize()
Set App = Application
End Sub
Private Sub App_SheetChange(ByVal Sh As Object, ByVal Target As Range)
On Error GoTo Err
If InStr(Target.Formula, "=MINtoHMS") Then
Target.NumberFormat = "hh:mm:ss"
End If
On Error GoTo 0
Exit Sub
Err:
End Sub
Add a module with the following code:
Option Explicit
Public MySheetHandler As SheetChangeHandler
Sub Auto_Open()
Set MySheetHandler = New SheetChangeHandler
End Sub
Function MINtoHMS(MIN)
MIN = MIN / (24 * 60)
MINtoHMS = MIN
End Function
Click File > Save As > Excel 97-2003 Add-In (*.xla) > Save
Click File > Options > Add-Ins
Click "Go..." next to Manage: Excel Add-ins
Check the box next to the add-in you just created
Click "OK"