Changes btw worksheets

G

Guest

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
 
T

Tom Ogilvy

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top