Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 465
Default Update a cell with a time.


HI All

When the content of any of the cells in the range D4:F6 changes , I need
the date and time to be placed in D10.


Can someone help with some code please?


Grateful for any advice.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1,522
Default Update a cell with a time.

Right click sheet tabview codeinsert thisformat d10 as desired.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("d4:f6")) Is Nothing Then Exit Sub
Range("d10") = Now
End Sub


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Colin Hayes" wrote in message
...

HI All

When the content of any of the cells in the range D4:F6 changes , I need
the date and time to be placed in D10.


Can someone help with some code please?


Grateful for any advice.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Update a cell with a time.


Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Cell As Range
Const WS_RANGE As String = "D4:F6"
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
On Error GoTo endit
Application.EnableEvents = False
Me.Range("D10").Value = Format(Now, "mm/dd/yyyy hh:mm:ss")
End If
endit:
Application.EnableEvents = True
End Sub

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

Copy/paste into that sheet module.

Alt + q to return to Excel.


Gord Dibben MS Excel MVP

On Tue, 26 Jan 2010 23:13:15 +0000, Colin Hayes
wrote:


HI All

When the content of any of the cells in the range D4:F6 changes , I need
the date and time to be placed in D10.


Can someone help with some code please?


Grateful for any advice.


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 465
Default Update a cell with a time.


HI

Thanks for the coding - I'm grateful.

I experimented a little and find that it will not put the date and time
where the cells in the specified range are updated from a remote source.


It only works when I update manually directly onto the sheet.

The cells D4:F6 are updated via formula referring to second worksheet in
the same workbook. Can the code be modified to accommodate this?



Best Wishes



In article , Gord Dibben
<gorddibbATshawDOTca@?.? writes

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim Cell As Range
Const WS_RANGE As String = "D4:F6"
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
On Error GoTo endit
Application.EnableEvents = False
Me.Range("D10").Value = Format(Now, "mm/dd/yyyy hh:mm:ss")
End If
endit:
Application.EnableEvents = True
End Sub

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

Copy/paste into that sheet module.

Alt + q to return to Excel.


Gord Dibben MS Excel MVP

On Tue, 26 Jan 2010 23:13:15 +0000, Colin Hayes
wrote:


HI All

When the content of any of the cells in the range D4:F6 changes , I need
the date and time to be placed in D10.


Can someone help with some code please?


Grateful for any advice.



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
Cell Update only at a specific time. Scott520 Excel Discussion (Misc queries) 4 August 8th 13 08:41 PM
Update date & time in a cell only when worksheet is changed RJD Excel Discussion (Misc queries) 6 December 23rd 09 03:57 PM
Setting time of last update in a cell R Mallory Excel Discussion (Misc queries) 7 January 16th 07 09:47 PM
Click a cell and update to current time / date ? Eric Excel Discussion (Misc queries) 3 October 4th 06 12:12 AM
How do you continuously update time and date in an Excel cell? engine99 Excel Worksheet Functions 7 February 21st 05 02:20 AM


All times are GMT +1. The time now is 06:04 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"