Posted to microsoft.public.excel.misc
|
|
Current Time
Format as general and you get lots of decimal places or as number and specify
how many decimal places you want
Mike
"albertmb" wrote:
Thanks Mike it worked perfectly, but yet another problem, I inserted a time
in cell B1 and in cell C1 I wrote this formula:(B1-A1)*24, the result came
out ok but still with the date included is it possible to fix this?
Thanks again
"Mike H" wrote:
Hi,
You can do that but need to be aware that while your PC is updating this
time it's doing nothing else so there is an overhead in doing what you want.
Not a massive one but nevertheless it's there.
Put this code in a general module. Alt + f11 to open VB editor. Right click
'ThisWorkbook' and insert module and paste this code in
Dim UpDate As Date
Sub Recalc()
Sheets("Sheet1").Range("A1").Value = Format(Time, "hh:mm:ss AM/PM")
Call UpDateTime
End Sub
Sub UpDateTime()
UpDate = Now + TimeValue("00:00:01")
Application.OnTime UpDate, "Recalc"
End Sub
Sub StopClock()
On Error Resume Next
Application.OnTime EarliestTime:=UpDate, Procedu="Recalc", Schedule:=False
End Sub
Then double click 'ThisWorkbook' and paste this in on the right
Private Sub Workbook_BeforeClose(Cancel As Boolean)
StopClock
End Sub
Run the sub called 'ReCalc and you get a realtime clock in A1 Sheet 1
Mike
"albertmb" wrote:
Hi Everyone,
I need a function that gives me the current time and updates the time in
real time.
I used the NOW() function but it gives me also the date and when I customed
the cell removing the date, it only removes it visualy, and although it
updates it does not update in real time.
I thank you in anticipation.
Albert
|