Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How use info in Excel shared worksheets to create new worksheets | Excel Worksheet Functions | |||
How do i assign the ActiveWorkbook.Worksheets to a worksheets object? | Excel Worksheet Functions | |||
Assigning Cells in worksheets to other data in other worksheets. | Excel Discussion (Misc queries) | |||
Sort Numerically Worksheets via VB when creating a new worksheets | Excel Programming | |||
Need code to protect worksheets - amount of worksheets varies | Excel Programming |