View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
vezerid
 
Posts: n/a
Default Cell format changing on the fly

Bellz,
First of all, (at least my version of) Excel does not accept :30 as
time. It is accepted as text.

With this said, your job can be done with an event macro:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As
Range)
If Left(Target.Value, 1) = ":" And IsNumeric(Mid(Target.Value, 2,
Len(Target.Value))) Then
Target.Value = CInt(Mid(Target.Value, 2, Len(Target.Value))) / 60
End If
End Sub

Press Alt+F11 to bring up the VBA IDE.
At the top left is the Project Explorer window.
Under the workbook you want to work with there is the icon
ThisWorkbook.
Double-click the icon to bring up the VBA code page for the workbook.
Paste the above code.

HTH
Kostis Vezerides