Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Automatic Time and Date

Hi, I have a situation similar to D. West where I'd like for the current
time and date to be entered in col. A whenever a new row is populated with
values. I tried the setting col. A to: =IF(COUNTA(B3:IV3)<0,NOW(),"") like
Gary Brown suggested for D.West. That sort of worked, but I'd like for that
value to remain, not be subject to recalculation whenever something new is
added to that or other rows. Any way to specify that value to remain
unchanged once it's calculated the first time? Thanks.
Larry


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Automatic Time and Date

you might try to use Worksheet_Change event (go to sheet tab, right-
click on it, click Show code, instead of "(General)" select
"Worksheet" and then "Change" in the rightmost window)

Private Sub Worksheet_Change(ByVal Target As Range)
Cells(Selection.Row - 1, 1) = Time
End Sub

provided entering data moves you 1 row down
however this will cause time to be entered to cells in 1st column also
on editing any cell

HIH
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Automatic Time and Date

Hi Jarek. I couldn't get it to work. I may have the Cell callout messed up.
Can you show me an example of what to put in for "Cells(Selection.Row - 1,
1) = Time". Thanks.
Larry

"Jarek Kujawa" wrote in message
...
you might try to use Worksheet_Change event (go to sheet tab, right-
click on it, click Show code, instead of "(General)" select
"Worksheet" and then "Change" in the rightmost window)

Private Sub Worksheet_Change(ByVal Target As Range)
Cells(Selection.Row - 1, 1) = Time
End Sub

provided entering data moves you 1 row down
however this will cause time to be entered to cells in 1st column also
on editing any cell

HIH



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Automatic Time and Date

....Gord's solution is very good...
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Automatic Time and Date

Private Sub WorkSheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B:B")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

Will add a timestamp to cell in column A when a change is made in
corresponding cell in row of column B

The timestamp does not update unless column A is edited.

This is sheet event code. Right-click on the sheet tab and "Viedw Code"

Copy/paste into that sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP


On Fri, 15 Aug 2008 15:47:59 -0400, "Larry"
wrote:

Hi, I have a situation similar to D. West where I'd like for the current
time and date to be entered in col. A whenever a new row is populated with
values. I tried the setting col. A to: =IF(COUNTA(B3:IV3)<0,NOW(),"") like
Gary Brown suggested for D.West. That sort of worked, but I'd like for that
value to remain, not be subject to recalculation whenever something new is
added to that or other rows. Any way to specify that value to remain
unchanged once it's calculated the first time? Thanks.
Larry




  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3
Default Automatic Time and Date

Gord, thanks. Your suggestion seems to work great. Now, I don't really want
the date stamp in column A. How do I change the date stamp to, say, column
E?
Thanks.
Larry

"Gord Dibben" <gorddibbATshawDOTca wrote in message
...
Private Sub WorkSheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B:B")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

Will add a timestamp to cell in column A when a change is made in
corresponding cell in row of column B

The timestamp does not update unless column A is edited.

This is sheet event code. Right-click on the sheet tab and "Viedw Code"

Copy/paste into that sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP


On Fri, 15 Aug 2008 15:47:59 -0400, "Larry"
wrote:

Hi, I have a situation similar to D. West where I'd like for the current
time and date to be entered in col. A whenever a new row is populated with
values. I tried the setting col. A to: =IF(COUNTA(B3:IV3)<0,NOW(),"")
like
Gary Brown suggested for D.West. That sort of worked, but I'd like for
that
value to remain, not be subject to recalculation whenever something new is
added to that or other rows. Any way to specify that value to remain
unchanged once it's calculated the first time? Thanks.
Larry



  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Automatic Time and Date

Column E Offset from column B would be

..Offset(0, 3) instead of .Offset(0, -1)

Offset(Row, Column) is the syntax.


Gord

On Fri, 15 Aug 2008 18:28:45 -0400, "Larry"
wrote:

Gord, thanks. Your suggestion seems to work great. Now, I don't really want
the date stamp in column A. How do I change the date stamp to, say, column
E?
Thanks.
Larry

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Private Sub WorkSheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B:B")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

Will add a timestamp to cell in column A when a change is made in
corresponding cell in row of column B

The timestamp does not update unless column A is edited.

This is sheet event code. Right-click on the sheet tab and "Viedw Code"

Copy/paste into that sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP


On Fri, 15 Aug 2008 15:47:59 -0400, "Larry"
wrote:

Hi, I have a situation similar to D. West where I'd like for the current
time and date to be entered in col. A whenever a new row is populated with
values. I tried the setting col. A to: =IF(COUNTA(B3:IV3)<0,NOW(),"")
like
Gary Brown suggested for D.West. That sort of worked, but I'd like for
that
value to remain, not be subject to recalculation whenever something new is
added to that or other rows. Any way to specify that value to remain
unchanged once it's calculated the first time? Thanks.
Larry



  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2
Default Automatic Time and Date

This worked!!! You guys are lifesavers! Thanks so much. I do have one other
question. Is there any way to change it to regular time instead of military
time?

"Gord Dibben" wrote:

Column E Offset from column B would be

..Offset(0, 3) instead of .Offset(0, -1)

Offset(Row, Column) is the syntax.


Gord

On Fri, 15 Aug 2008 18:28:45 -0400, "Larry"
wrote:

Gord, thanks. Your suggestion seems to work great. Now, I don't really want
the date stamp in column A. How do I change the date stamp to, say, column
E?
Thanks.
Larry

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Private Sub WorkSheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B:B")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

Will add a timestamp to cell in column A when a change is made in
corresponding cell in row of column B

The timestamp does not update unless column A is edited.

This is sheet event code. Right-click on the sheet tab and "Viedw Code"

Copy/paste into that sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP


On Fri, 15 Aug 2008 15:47:59 -0400, "Larry"
wrote:

Hi, I have a situation similar to D. West where I'd like for the current
time and date to be entered in col. A whenever a new row is populated with
values. I tried the setting col. A to: =IF(COUNTA(B3:IV3)<0,NOW(),"")
like
Gary Brown suggested for D.West. That sort of worked, but I'd like for
that
value to remain, not be subject to recalculation whenever something new is
added to that or other rows. Any way to specify that value to remain
unchanged once it's calculated the first time? Thanks.
Larry




  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 896
Default Automatic Time and Date

re-format yr cells
HIH
  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 46
Default Automatic Time and Date

I am currently doing something similar, where data inputted in column A will
insert the date into column E.

This is to copied through the whole worksheet (well down to about 500ish
rows)

I have used the formula:

=IF(COUNTA(A102)<0,NOW(),"")

In column E and inserted the following in visual basics:

Private Sub WorkSheet_Change(ByVal Target As Range)

Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A:A")) Is Nothing Then
With Target
If .Value < "" Then
..Offset(0, -1).Value = Format(Now, "dd mmm yyyy hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True

End Sub

However, redaing the below, it is likely that the above is incorrect (offset
values error??)

Please could someone help and advise,

NB, this will be used on machines that use XP office, 2003 & 2007.

Thanks

Aaron


"D. West" wrote in message
...
This worked!!! You guys are lifesavers! Thanks so much. I do have one
other
question. Is there any way to change it to regular time instead of
military
time?

"Gord Dibben" wrote:

Column E Offset from column B would be

..Offset(0, 3) instead of .Offset(0, -1)

Offset(Row, Column) is the syntax.


Gord

On Fri, 15 Aug 2008 18:28:45 -0400, "Larry"
wrote:

Gord, thanks. Your suggestion seems to work great. Now, I don't really
want
the date stamp in column A. How do I change the date stamp to, say,
column
E?
Thanks.
Larry

"Gord Dibben" <gorddibbATshawDOTca wrote in message
.. .
Private Sub WorkSheet_Change(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B:B")) Is Nothing Then
With Target
If .Value < "" Then
.Offset(0, -1).Value = Format(Now, "dd mmm yyyy
hh:mm:ss")
End If
End With
End If
ws_exit:
Application.EnableEvents = True
End Sub

Will add a timestamp to cell in column A when a change is made in
corresponding cell in row of column B

The timestamp does not update unless column A is edited.

This is sheet event code. Right-click on the sheet tab and "Viedw
Code"

Copy/paste into that sheet module.

Alt + q to return to the Excel window.


Gord Dibben MS Excel MVP


On Fri, 15 Aug 2008 15:47:59 -0400, "Larry"
wrote:

Hi, I have a situation similar to D. West where I'd like for the
current
time and date to be entered in col. A whenever a new row is populated
with
values. I tried the setting col. A to: =IF(COUNTA(B3:IV3)<0,NOW(),"")
like
Gary Brown suggested for D.West. That sort of worked, but I'd like for
that
value to remain, not be subject to recalculation whenever something
new is
added to that or other rows. Any way to specify that value to remain
unchanged once it's calculated the first time? Thanks.
Larry







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
Overlapping time calculations and automatic time updates Arlette Excel Worksheet Functions 1 December 9th 06 12:20 AM
Automatic date and time updation Qlychap Excel Discussion (Misc queries) 12 July 21st 06 02:57 PM
excel, automatic date and time when info gets entered shorty Excel Worksheet Functions 4 April 26th 06 06:46 PM
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 12:07 AM


All times are GMT +1. The time now is 10:58 PM.

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

About Us

"It's about Microsoft Excel"