BrutalDawg
New Member
- Joined
- Jun 10, 2015
- Messages
- 41
I have a macro that currently looks through two unique sheets and if criteria is met, pulls the row to sheet3. Below.
Now that I know what changed, I would like to bring over just the quantity of the matching items of the first sheet and place it in column I.
Anyone know an easy way to complete this?
Thanks all for the help.
Code:
Sub what_changed()
Dim ws1 As Worksheet, ws As Worksheet, ws3 As Worksheet, ws4 As Worksheet
Set ws1 = Worksheets("Sheet1")
Set ws2 = Worksheets("Sheet2")
Set ws3 = Worksheets("Sheet3")
Set ws4 = Worksheets("Helper")
ws3.Cells().ClearContents
ws4.Cells().ClearContents
wr = 1 'this will biul a List of "INdexNumbers" on sheet 4
For r = 2 To ws1.Range("A" & Rows.Count).End(xlUp).Row
ws4.Cells(wr, "A") = ws1.Cells(r, "A") & ws1.Cells(r, "D") & ws1.Cells(r, "F") & ws1.Cells(r, "G")
ws4.Cells(wr, "B") = ws1.Cells(r, "F") 'qty
wr = wr + 1
Next r
For r = 2 To ws2.Range("A" & Rows.Count).End(xlUp).Row
ino = ws2.Cells(r, "A") & ws2.Cells(r, "D") & ws2.Cells(r, "F") & ws2.Cells(r, "G")
If WorksheetFunction.CountIf(ws4.Range("A:A"), ino) = 0 Then 'add record as something changed
lr = ws3.Cells(Rows.Count, "A").End(xlUp).Row + 1
ws3.Rows(lr).EntireRow.Value = ws2.Rows(r).EntireRow.Value
ws3.Cells(lr, "H") = qty
End If
Next r
End Sub
Now that I know what changed, I would like to bring over just the quantity of the matching items of the first sheet and place it in column I.
Anyone know an easy way to complete this?
Thanks all for the help.