Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default track row changes with date and time stamp

I looked at a similiar request called "Track changes by row in different
worksheet - History tracking" that was posted previously and tried to modify
it.

What I would like to do is take my 37 column spreadsheet with a header row
and anytime any cell in a row is changed write the original row to the
History Sheet with the user ID (network) and a date and time stamp. I would
like the header row to be in the History file. If the ultimate was available
the changed cell(s) would be highlighted with a different color.
--
Thank You
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default track row changes with date and time stamp

to do this you'll need to keep a copy of the sheet. This is because once a
cell value is changed, you won't know what it was
The copy will give you this.
so use the change event to do two things....write the change to the history
file and also update the copy

so I have three sheets ... Main, MainCopy and MainHistory
whenever a change is made to Main, then MainCopy is updated and so is
MainHistory.

This is the code behind Main:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim saddress As String
saddress = Target.Address
If Worksheets("MainCopy").Range(saddress).Value < Target.Value Then
With Worksheets("MainHistory").Range("A" & Rows.Count).End(xlUp).Offset(1)
.Value = Cells(1, Target.Column) ' header
.Offset(, 1) = Worksheets("MainCopy").Range(saddress).Value 'old value
.Offset(, 2) = Target.Value 'new value
.Offset(, 3) = Environ$("username") 'user
.Offset(, 4) = Now
End With
Worksheets("MainCopy").Range(saddress).Value = Target.Value
End If
End Sub






"HarryisTrying" wrote:

I looked at a similiar request called "Track changes by row in different
worksheet - History tracking" that was posted previously and tried to modify
it.

What I would like to do is take my 37 column spreadsheet with a header row
and anytime any cell in a row is changed write the original row to the
History Sheet with the user ID (network) and a date and time stamp. I would
like the header row to be in the History file. If the ultimate was available
the changed cell(s) would be highlighted with a different color.
--
Thank You

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default track row changes with date and time stamp

This does what I need but I think I need to have an event when the workbook
is open to copy the main to the maincopy. If you can tell me how to do that
it would be appreciated. I think I could figure that one out but I am a
novice and have had times when I thought I had it right and then found it
didn't work well under circumstances I didn't test.

Also I added a line to capture what is in column 1 ( the name of the server)
so I can figure what specific server the change applies to. I added this to
your work

..Offset(, 4) = Now
.Offset(, 5) = Cells(Target.Row, 1) ' server name

I would really like the server name to be in column 1 on MainHistory
worksheet but I tried to move it and messed things up. The server name is now
the last column

Thanks for your help and it is appreciated. Thank You


"Patrick Molloy" wrote:

to do this you'll need to keep a copy of the sheet. This is because once a
cell value is changed, you won't know what it was
The copy will give you this.
so use the change event to do two things....write the change to the history
file and also update the copy

so I have three sheets ... Main, MainCopy and MainHistory
whenever a change is made to Main, then MainCopy is updated and so is
MainHistory.

This is the code behind Main:

Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim saddress As String
saddress = Target.Address
If Worksheets("MainCopy").Range(saddress).Value < Target.Value Then
With Worksheets("MainHistory").Range("A" & Rows.Count).End(xlUp).Offset(1)
.Value = Cells(1, Target.Column) ' header
.Offset(, 1) = Worksheets("MainCopy").Range(saddress).Value 'old value
.Offset(, 2) = Target.Value 'new value
.Offset(, 3) = Environ$("username") 'user
.Offset(, 4) = Now
End With
Worksheets("MainCopy").Range(saddress).Value = Target.Value
End If
End Sub






"HarryisTrying" wrote:

I looked at a similiar request called "Track changes by row in different
worksheet - History tracking" that was posted previously and tried to modify
it.

What I would like to do is take my 37 column spreadsheet with a header row
and anytime any cell in a row is changed write the original row to the
History Sheet with the user ID (network) and a date and time stamp. I would
like the header row to be in the History file. If the ultimate was available
the changed cell(s) would be highlighted with a different color.
--
Thank You

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
Time/Date Stamp RVS Excel Programming 3 June 18th 09 06:41 PM
Time/Date Stamp Rick Rothstein Excel Programming 0 June 17th 09 07:19 PM
Comparing 2 files on date/time stamp, and based time difference do a subroutine [email protected] Excel Programming 1 September 28th 07 03:53 AM
Date-Time Stamp [email protected] Excel Discussion (Misc queries) 1 September 27th 06 02:37 PM
date/time stamp Jan Excel Worksheet Functions 7 July 14th 05 01:04 PM


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