Changes btw worksheets
I have two spreadsheets: Jobs and Jobs 2
I want to know what differences there are btw the two worksheets, if there are differences the entire row from "Jobs2" is copied over to a "Changes" Worksheet, followed by the row from "Jobs" For Example: Jobs.xls: Client Jan Feb Mar GATT 100 150 200 Jobs2.xls: Client Jan Feb Mar GATT 150 250 300 I need to get to: Changes.xls Client Jan Feb Mar GATT 150 250 300 100 150 200 --------------------------------- 50 100 100 This is the code I have so far, I feel I'm missing a few lines: k = 2 For i = 1 To 300 For j = 1 To 70 If Worksheets("Jobs").Cells(i, j) < Worksheets("Jobs2").Cells(i, j) Then Worksheets("Jobs").Cells(i, j).EntireRow.Copy Destination:=Worksheets("Changes").Cells(k, 1) k = k + 1 Exit For End If Next j Next i |
Changes btw worksheets
k = 2
For i = 1 To 300 For j = 1 To 70 If Worksheets("Jobs").Cells(i, j) < Worksheets("Jobs2").Cells(i, j) Then Worksheets("Jobs2").Cells(i, j).EntireRow.Copy _ Destination:=Worksheets("Changes").Cells(k, 1) Worksheets("Jobs").Cells(i,j).EntireRow.Copy _ Destination:=Worksheets("Changes").Cells(k+1,1) with Worksheets("Changes") .Cells(k+1,1).clearContents for m = 2 to 70 .cells(k+2,m).Value = .cells(k,m) - .cells(k+1,m) Next m End with k = k + 3 Exit For End If Next j Next i -- Regards, Tom Ogilvy "teresa" wrote in message ... I have two spreadsheets: Jobs and Jobs 2 I want to know what differences there are btw the two worksheets, if there are differences the entire row from "Jobs2" is copied over to a "Changes" Worksheet, followed by the row from "Jobs" For Example: Jobs.xls: Client Jan Feb Mar GATT 100 150 200 Jobs2.xls: Client Jan Feb Mar GATT 150 250 300 I need to get to: Changes.xls Client Jan Feb Mar GATT 150 250 300 100 150 200 --------------------------------- 50 100 100 This is the code I have so far, I feel I'm missing a few lines: k = 2 For i = 1 To 300 For j = 1 To 70 If Worksheets("Jobs").Cells(i, j) < Worksheets("Jobs2").Cells(i, j) Then Worksheets("Jobs").Cells(i, j).EntireRow.Copy Destination:=Worksheets("Changes").Cells(k, 1) k = k + 1 Exit For End If Next j Next i |
All times are GMT +1. The time now is 01:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com