ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Calculating the current time in Excel 2007 (https://www.excelbanter.com/excel-programming/443326-calculating-current-time-excel-2007-a.html)

[email protected]

Calculating the current time in Excel 2007
 
Hi Everyone,

And thanks in advance for any replies.

Like most people, I have lots of problems calculating times in Excel.
And this time, I'm completely stuck!!!

I'll try and explain this as precisely as possible so everyone
understands. I'm sure others will also appreciate the answer.


I need to put the current time in a cell. This must be updated on each
refresh.

In a second cell, I need to calculate the current time plus a time
that I set. For instance, CurrentTime+ 40 seconds.
The idea is to use this final value in a VBA procedure, if that's any
help.


Many Thanks,




Herbie

James Ravenswood

Calculating the current time in Excel 2007
 
On Jul 12, 10:13*am, wrote:
Hi Everyone,

And thanks in advance for any replies.

Like most people, I have lots of problems calculating times in Excel.
And this time, I'm completely stuck!!!

I'll try and explain this as precisely as possible so everyone
understands. I'm sure others will also appreciate the answer.

I need to put the current time in a cell. This must be updated on each
refresh.

In a second cell, I need to calculate the current time plus a time
that I set. For instance, CurrentTime+ 40 seconds.
The idea is to use this final value in a VBA procedure, if that's any
help.

Many Thanks,

Herbie


The following puts the time in the active cell and 40 seconds later in
the adjacent cell:

Sub timeIt()
With ActiveCell
.Value = Now - Int(Now)
.Offset(0, 1).Value = .Value + TimeValue("00:00:40")
.Offset(0, 1).NumberFormat = "[$-F400]h:mm:ss AM/PM"
End With
End Sub

Jim Cone[_2_]

Calculating the current time in Excel 2007
 

In A5 enter "40"
In B5 enter "=Now()"
In C5 enter "=B5+A5/86400)

Format B5 and C5 with an appropriate "Time" custom number format.
(possibly: "h:mm:ss AM/PM")

--
Jim Cone
Portland, Oregon USA
"thanks in advance means no thanks"
http://www.contextures.com/excel-sort-addin.html





wrote in message
Hi Everyone,

And thanks in advance for any replies.

Like most people, I have lots of problems calculating times in Excel.
And this time, I'm completely stuck!!!

I'll try and explain this as precisely as possible so everyone
understands. I'm sure others will also appreciate the answer.


I need to put the current time in a cell. This must be updated on each
refresh.

In a second cell, I need to calculate the current time plus a time
that I set. For instance, CurrentTime+ 40 seconds.
The idea is to use this final value in a VBA procedure, if that's any
help.


Many Thanks,




Herbie

Wouter HM

Calculating the current time in Excel 2007
 
Hi Peter,

In A1 enter 'Current tme:'
In B1 enter '=Now()'
In A3 enter 'Hours:'
In B3 enter '0'
In A4 enter 'Minutes'
In B4 enter '0'
In A5 enter 'Seconds'
In B5 enter '40'
In A6 enter 'Time Gap'
In B6 enter '=Time(B3,B4,B5)'
In A8 enter 'End time:'
In B8 enter '=B1+B6'

For B1, B6 and B8 set the numberformat to '"[$-F400]h:mm:ss'


All times are GMT +1. The time now is 05:16 AM.

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