ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy changed rows into a new sheet and save them (https://www.excelbanter.com/excel-programming/322195-copy-changed-rows-into-new-sheet-save-them.html)

EM[_2_]

Copy changed rows into a new sheet and save them
 
Is it possible (of course it is..., but) to make a simple macro (or some
other way) to copy all the changed records to sheet2. I mean the whole
row....
And how does this clever Xl-alien in my computer now that at first time one
row is copied to row1 but next time it is row2 and so on...

And 1 more thing... I have a function in one cell that shoud be the date the
record was created, but it keeps changing...

sorry my english and confused explanations



gocush[_29_]

Copy changed rows into a new sheet and save them
 
Assume you are working in Sheet1 and you make a change to any cell in
Range("A1:D100"). The following code will copy the entire row where you made
the change and add that row to next blank row of Sheet2 Col A. Keep in mind,
if you make say 4 changes in row 10, this will add 4 rows to Sheet2, ie it
does not delete the previously copied rows.


Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count 1 Then Exit Sub
If Not Intersect(Target, Range("A1:D100")) Is Nothing Then
Target.EntireRow.Copy _
Destination:=Sheets("Sheet2").Range("A65536").End( xlUp)(2)
End If

End Sub

To install this code: highlight it and copy
Go to sheet1 and RT-click on the TAB
Click View Code
Paste the code in the right panel

"EM" wrote:

Is it possible (of course it is..., but) to make a simple macro (or some
other way) to copy all the changed records to sheet2. I mean the whole
row....
And how does this clever Xl-alien in my computer now that at first time one
row is copied to row1 but next time it is row2 and so on...

And 1 more thing... I have a function in one cell that shoud be the date the
record was created, but it keeps changing...

sorry my english and confused explanations




emma makela

Copy changed rows into a new sheet and save them
 




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

emma makela

Copy changed rows into a new sheet and save them
 
Well, it works half(?). In my hands, it only copies the data if it's
made in columnA.. How to put it, so that it cheks the whole sheet1?
Sorry my stupidity..., just started with this...



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

EM[_2_]

Copy changed rows into a new sheet and save them
 

That problem solved:)




"emma makela" kirjoitti
...
Well, it works half(?). In my hands, it only copies the data if it's
made in columnA.. How to put it, so that it cheks the whole sheet1?
Sorry my stupidity..., just started with this...



*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!





All times are GMT +1. The time now is 05:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com