Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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? |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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? |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() "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. |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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? |
#5
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() "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. |
#6
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#7
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() "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. |
#8
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Formula that will record the time and date when an entry is made on a sheet | Excel Worksheet Functions | |||
Record date cell is inputted | Excel Discussion (Misc queries) | |||
Macro to record user name and date/time | Excel Discussion (Misc queries) | |||
automatically insert system time in a cell | Excel Discussion (Misc queries) | |||
How do I get one cell to record the time another cell was changed. | Excel Discussion (Misc queries) |