ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I get the system date & time for different cell record (https://www.excelbanter.com/excel-discussion-misc-queries/172072-how-can-i-get-system-date-time-different-cell-record.html)

Get System Date & Time

How can I get the system date & time for different cell record
 
I'm trying to use EXCEL to capture transactions. For each transaction record,
I need to get the notebook system date & time. I use the "Now()" function,
but each time I hit enter all the values in the column changes to the current
date & time values. Is there another function/fomulae?

Bob Phillips

How can I get the system date & time for different cell record
 
Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H:H" '<== change to suit

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Format(Now, "dd mmm yyy hh:mm:ss")
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)



"Get System Date & Time" <Get System Date &
wrote in message ...
I'm trying to use EXCEL to capture transactions. For each transaction
record,
I need to get the notebook system date & time. I use the "Now()" function,
but each time I hit enter all the values in the column changes to the
current
date & time values. Is there another function/fomulae?




Gary''s Student

How can I get the system date & time for different cell record
 
Instead of =NOW() use:

CNTRL-; CNTRL-:
--
Gary''s Student - gsnu200764


"Get System Date & Time" wrote:

I'm trying to use EXCEL to capture transactions. For each transaction record,
I need to get the notebook system date & time. I use the "Now()" function,
but each time I hit enter all the values in the column changes to the current
date & time values. Is there another function/fomulae?


Get System Date & Time[_2_]

How can I get the system date & time for different cell record
 


"Gary''s Student" wrote:

Instead of =NOW() use:

CNTRL-; CNTRL-:
--
Gary''s Student - gsnu200764


"Get System Date & Time" wrote:

Sorry I tried "CNTRL-; CNTRL-:" but it does not work. I must have got it wrong. Please elaborate.



Get System Date & Time[_2_]

How can I get the system date & time for different cell record
 


"Bob Phillips" wrote:

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

On Error GoTo ws_exit
Application.EnableEvents = False

If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
.Offset(0, 1).Value = Format(Now, "dd mmm yyy hh:mm:ss")
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)



"Get System Date & Time"

Thanks Bob for your help but I did not get it to work. I must have done
something wrong.



Dave Peterson

How can I get the system date & time for different cell record
 
Hit and hold the control key
hit the semi-colon key (;)
(you'll see the date entered into the formulabar)
let go of the control key

Hit the space bar

hit and hold the control key
hit the colon key (:)
(you'll see the time added to the formulabar)
let go of the control key

Hit enter to finish.

When you're done, you should see something like:
01/08/2008 09:12:00 AM
in the formulabar

(I use USA date order. Yours may be different.)



Get System Date & Time wrote:

"Gary''s Student" wrote:

Instead of =NOW() use:

CNTRL-; CNTRL-:
--
Gary''s Student - gsnu200764


"Get System Date & Time" wrote:

Sorry I tried "CNTRL-; CNTRL-:" but it does not work. I must have got it wrong. Please elaborate.


--

Dave Peterson

Get System Date & Time[_2_]

How can I get the system date & time for different cell record
 


"Dave Peterson" wrote:

Hit and hold the control key
hit the semi-colon key (;)
(you'll see the date entered into the formulabar)
let go of the control key

Hit the space bar

hit and hold the control key
hit the colon key (:)
(you'll see the time added to the formulabar)
let go of the control key

Hit enter to finish.

When you're done, you should see something like:
01/08/2008 09:12:00 AM
in the formulabar

(I use USA date order. Yours may be different.)


Get System Date & Time wrote:

"Gary''s Student" wrote:

Instead of =NOW() use:

CNTRL-; CNTRL-:
--
Gary''s Student - gsnu200764


"Get System Date & Time" wrote:

Sorry I tried "CNTRL-; CNTRL-:" but it does not work. I must have got it wrong. Please elaborate.


--

Dave Peterson

Hi Dave, Thanks I got it to work. Thanks to "gary's Student" as I now
realise what you meant.

Bob Phillips

How can I get the system date & time for different cell record
 
Be aware though that it only shows hours and minutes, not the seconds.

--
---
HTH

Bob


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



"Get System Date & Time" wrote
in message ...


"Dave Peterson" wrote:

Hit and hold the control key
hit the semi-colon key (;)
(you'll see the date entered into the formulabar)
let go of the control key

Hit the space bar

hit and hold the control key
hit the colon key (:)
(you'll see the time added to the formulabar)
let go of the control key

Hit enter to finish.

When you're done, you should see something like:
01/08/2008 09:12:00 AM
in the formulabar

(I use USA date order. Yours may be different.)


Get System Date & Time wrote:

"Gary''s Student" wrote:

Instead of =NOW() use:

CNTRL-; CNTRL-:
--
Gary''s Student - gsnu200764


"Get System Date & Time" wrote:

Sorry I tried "CNTRL-; CNTRL-:" but it does not work. I must have
got it wrong. Please elaborate.


--

Dave Peterson

Hi Dave, Thanks I got it to work. Thanks to "gary's Student" as I now
realise what you meant.




Get System Date & Time[_2_]

How can I get the system date & time for different cell record
 


"Bob Phillips" wrote:

Be aware though that it only shows hours and minutes, not the seconds.

--
---
HTH

Bob


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



"Get System Date & Time" wrote
in message ...

Thanks Bob. You are right. hh:mm is fine with me. By the way, Dave, I use a custom format in the cell and was able to display the date in the right format.





All times are GMT +1. The time now is 02:08 AM.

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