Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting text format of time/date into Excel time/date for subtr YY san.[_2_] Excel Worksheet Functions 6 February 25th 10 08:27 AM
Calculating days & time left from start date/time to end date/time marie Excel Worksheet Functions 7 December 7th 05 02:36 PM
Combined date time cell to separate date & time components Mark Ada Excel Discussion (Misc queries) 1 December 2nd 04 02:48 AM
Combined date time cell to separate date & time components Mark Ada Excel Discussion (Misc queries) 1 December 2nd 04 12:07 AM
Combined date time cell to separate date & time components Mark Ada Excel Worksheet Functions 1 December 2nd 04 12:04 AM


All times are GMT +1. The time now is 04:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"