Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Updating a last modified date using the worksheet change event

I have an Excel 2003 workbook to manage large amounts of data. I want to
track changes made to the data, but I don't want to use Excel's track changes
feature as I don't like the display options.

I created two columns in my worksheet, Last Modified Date and Last Modified
Time. I want the values in these columns to be updated to the system date
and time, any time the value of any cell in the same row is changed.

The following code off the worksheet change event is close to what I want,
but when ranges of cells are pasted into my working area, I want ALL the last
modified date and times to be set for each row that was part of the paste.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Union(Target, Range("A8:O65536")).Address = "$A$8:$O$65536" Then
Cells(Target.Cells.Row, 20) = Date
Cells(Target.Cells.Row, 21) = Time
End If
Application.EnableEvents = True
End Sub

What do I use to get all the date/time values (columns 20 and 21) to change
for all the rows in my range?

--
Thanks,

Bruce Bolio
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Updating a last modified date using the worksheet change event

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell as Range
Application.EnableEvents = False
If Union(Target, Range("A8:O65536")).Address = "$A$8:$O$65536" Then
for each cell in Target
Cells(cell.Row, 20) = Date
Cells(cell.Row, 21) = Time
Next
End If

Application.EnableEvents = True
End Sub

--
Regards,
Tom Ogilvy

"Bruce Bolio" wrote:

I have an Excel 2003 workbook to manage large amounts of data. I want to
track changes made to the data, but I don't want to use Excel's track changes
feature as I don't like the display options.

I created two columns in my worksheet, Last Modified Date and Last Modified
Time. I want the values in these columns to be updated to the system date
and time, any time the value of any cell in the same row is changed.

The following code off the worksheet change event is close to what I want,
but when ranges of cells are pasted into my working area, I want ALL the last
modified date and times to be set for each row that was part of the paste.

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
If Union(Target, Range("A8:O65536")).Address = "$A$8:$O$65536" Then
Cells(Target.Cells.Row, 20) = Date
Cells(Target.Cells.Row, 21) = Time
End If
Application.EnableEvents = True
End Sub

What do I use to get all the date/time values (columns 20 and 21) to change
for all the rows in my range?

--
Thanks,

Bruce Bolio

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
Updating a DATE, only if the page has been modified. Michael Excel Discussion (Misc queries) 4 April 6th 10 12:53 PM
Excel Updating Modified Date When I Don't Save File Charles Excel Discussion (Misc queries) 4 May 14th 09 01:27 AM
Use date modified to change format & create filter to track change PAR Excel Worksheet Functions 0 November 15th 06 09:17 PM
Updating another sheet using an On Change event Steve Barber Excel Programming 2 February 25th 05 02:05 PM


All times are GMT +1. The time now is 10:33 AM.

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"