Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
Hi! I am trying to make a communicationlogg with a field that is
supposed to be auto updated with date and time in the same cell. The time is supposed to be auto updated from the PC clock and the whole cell should be filled out just with hitting the return button. Is this possible? (Sorry for bad English.) Johan |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
=now()
in the cell, then hit F9 to update. It will actually update each time the sheet is calculated. -- Regards, Tom Ogilvy "Johan H. Olsen" wrote in message ... Hi! I am trying to make a communicationlogg with a field that is supposed to be auto updated with date and time in the same cell. The time is supposed to be auto updated from the PC clock and the whole cell should be filled out just with hitting the return button. Is this possible? (Sorry for bad English.) Johan |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
On Sun, 15 May 2005 13:23:26 -0400, "Tom Ogilvy"
wrote: =now() in the cell, then hit F9 to update. It will actually update each time the sheet is calculated. Yes i see. but this only updates the one cell i am in. This is supposed to be a row of cells and each time we use a new line, we need to type inn the date and the time. This we would like to have more "auto". Sorry if i didn't explain myself good enough, its not so easy to make one selves understood in English. :-) |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
On Sun, 15 May 2005 19:36:17 +0200, Johan H. Olsen
wrote: On Sun, 15 May 2005 13:23:26 -0400, "Tom Ogilvy" wrote: =now() in the cell, then hit F9 to update. It will actually update each time the sheet is calculated. Yes i see. but this only updates the one cell i am in. This is supposed to be a row of cells and each time we use a new line, we need to type inn the date and the time. This we would like to have more "auto". Sorry if i didn't explain myself good enough, its not so easy to make one selves understood in English. :-) And the date/time in the cells that already has values should NOT be updated. Then all the cells get the same time/date.. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
Right click on the sheet tab and select view code.
in the left dropdown at the top of the resulting module select workbook and in the right dropdown select Change (not selectionchange) Private Sub Worksheet_Change(ByVal Target As Excel.Range) End Sub should appear. I don't know your exact situation, but let us say we want to put a date time value in column A whenever an entry is made in column B Private Sub Worksheet_Change(ByVal Target As Excel.Range) if target.count 1 then exit sub if target.column = 2 then With target.offset(0,-1) if not isempty(.value) then .Value = now .Numberformat = "dd/mm/yyyy hh:mm" .entireColumn.Autofit end if end with End if End Sub for general information on events, see Chip Pearson's page on events http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy End Sub "Johan H. Olsen" wrote in message ... On Sun, 15 May 2005 19:36:17 +0200, Johan H. Olsen wrote: On Sun, 15 May 2005 13:23:26 -0400, "Tom Ogilvy" wrote: =now() in the cell, then hit F9 to update. It will actually update each time the sheet is calculated. Yes i see. but this only updates the one cell i am in. This is supposed to be a row of cells and each time we use a new line, we need to type inn the date and the time. This we would like to have more "auto". Sorry if i didn't explain myself good enough, its not so easy to make one selves understood in English. :-) And the date/time in the cells that already has values should NOT be updated. Then all the cells get the same time/date.. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
Made an error. Revision is:
Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Count 1 Then Exit Sub If Target.Column = 2 Then With Target.Offset(0, -1) If Not IsEmpty(Target.Value) Then .Value = Now .NumberFormat = "dd/mm/yyyy hh:mm" .EntireColumn.AutoFit End If End With End If End Sub -- Regards, Tom Ogilvy "Tom Ogilvy" wrote in message ... Right click on the sheet tab and select view code. in the left dropdown at the top of the resulting module select workbook and in the right dropdown select Change (not selectionchange) Private Sub Worksheet_Change(ByVal Target As Excel.Range) End Sub should appear. I don't know your exact situation, but let us say we want to put a date time value in column A whenever an entry is made in column B Private Sub Worksheet_Change(ByVal Target As Excel.Range) if target.count 1 then exit sub if target.column = 2 then With target.offset(0,-1) if not isempty(.value) then .Value = now .Numberformat = "dd/mm/yyyy hh:mm" .entireColumn.Autofit end if end with End if End Sub for general information on events, see Chip Pearson's page on events http://www.cpearson.com/excel/events.htm -- Regards, Tom Ogilvy End Sub "Johan H. Olsen" wrote in message ... On Sun, 15 May 2005 19:36:17 +0200, Johan H. Olsen wrote: On Sun, 15 May 2005 13:23:26 -0400, "Tom Ogilvy" wrote: =now() in the cell, then hit F9 to update. It will actually update each time the sheet is calculated. Yes i see. but this only updates the one cell i am in. This is supposed to be a row of cells and each time we use a new line, we need to type inn the date and the time. This we would like to have more "auto". Sorry if i didn't explain myself good enough, its not so easy to make one selves understood in English. :-) And the date/time in the cells that already has values should NOT be updated. Then all the cells get the same time/date.. |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
On Sun, 15 May 2005 13:58:46 -0400, "Tom Ogilvy"
wrote: Made an error. Revision is: Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Count 1 Then Exit Sub If Target.Column = 2 Then With Target.Offset(0, -1) If Not IsEmpty(Target.Value) Then .Value = Now .NumberFormat = "dd/mm/yyyy hh:mm" .EntireColumn.AutoFit End If End With End If End Sub So far thnx. It putted in the 1.0.00 00:00 in the cell.. but i would like to have it to put in today's date and time taken from computers clock..and its important that it does NOT change the time/clock in any other cell than the one i at the moment is standing in,,puhhh this is more complicated than i belived..:-) |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
It sounds like you didn't alter the code properly.
From the immediate window: ? Now 5/15/05 4:17:41 PM shows that now puts in what you ask for. (it certainly doesn't put in a zero - which i suspect is what you are showing) Perhaps post your version of the code and say what column will contain the date/time and what column triggers the code. -- Regards, Tom Ogilvy "Johan H. Olsen" wrote in message ... On Sun, 15 May 2005 13:58:46 -0400, "Tom Ogilvy" wrote: Made an error. Revision is: Private Sub Worksheet_Change(ByVal Target As Excel.Range) If Target.Count 1 Then Exit Sub If Target.Column = 2 Then With Target.Offset(0, -1) If Not IsEmpty(Target.Value) Then .Value = Now .NumberFormat = "dd/mm/yyyy hh:mm" .EntireColumn.AutoFit End If End With End If End Sub So far thnx. It putted in the 1.0.00 00:00 in the cell.. but i would like to have it to put in today's date and time taken from computers clock..and its important that it does NOT change the time/clock in any other cell than the one i at the moment is standing in,,puhhh this is more complicated than i belived..:-) |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
On Sun, 15 May 2005 16:20:07 -0400, "Tom Ogilvy"
wrote: It sounds like you didn't alter the code properly. From the immediate window: ? Now 5/15/05 4:17:41 PM shows that now puts in what you ask for. (it certainly doesn't put in a zero - which i suspect is what you are showing) Perhaps post your version of the code and say what column will contain the date/time and what column triggers the code. Would like more to post/send the whole sheet to you as you look like you have lots of knowledge in this. Myself i am complete newbie and doesn't really know what to do.. :-) Johan |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
Date/time groupe
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Converting text format of time/date into Excel time/date for subtr | Excel Worksheet Functions | |||
Calculating days & time left from start date/time to end date/time | Excel Worksheet Functions | |||
Combined date time cell to separate date & time components | Excel Discussion (Misc queries) | |||
Combined date time cell to separate date & time components | Excel Discussion (Misc queries) | |||
Combined date time cell to separate date & time components | Excel Worksheet Functions |