hi, i am having two sheets in my excel, first sheet named sales, the other one named sent,
in sheet sales i have all my data, column "B" is the Sku, and column "H" is qty.
in sheet sent, there is a report what i get every morning from Qty that got changed, So i have there in column "A" the Sku, and column "D" is the new Qty,
now i need that my sheet sales should get updated automatically from sheet sent.
i tried already alot of ways, spending weeks without success, maybe someone can help me out here, i will give some ways what i tried and where i get stuck.
in the above code, it get stuck here> Set MyUpdate = Sent.Range("A:A").UsedRange
Set OldList = Sales.Range("B:B").UsedRange
here is another code i tried, actuelly with the help of a mrexcel thread
http://www.mrexcel.com/forum/excel-questions/9419-compare-list-b-add-records-b-not.html
here is my code,
by this code i get stuck here> If C = Rng1 Then "error Type Mismatch"
can anyone help me out?
i am really sick of working on that for weeks.
in sheet sales i have all my data, column "B" is the Sku, and column "H" is qty.
in sheet sent, there is a report what i get every morning from Qty that got changed, So i have there in column "A" the Sku, and column "D" is the new Qty,
now i need that my sheet sales should get updated automatically from sheet sent.
i tried already alot of ways, spending weeks without success, maybe someone can help me out here, i will give some ways what i tried and where i get stuck.
Code:
Sub MyIfCode()
Dim I As Range
Dim r As Range
Dim MyUpdate As Range
Dim OldList As Range
Dim Sales As Object
Dim Sent As Object
Set Sales = Worksheets("Sales")
Set Sent = Worksheets("Sent")
Set MyUpdate = Sent.Range("A:A").UsedRange
Set OldList = Sales.Range("B:B").UsedRange
For Each I In MyUpdate
For Each r In OldList
If I = r Then
r.Offset(0, 6) = I.Offset(0, 3)
End If
Next r
Next I
End Sub
Set OldList = Sales.Range("B:B").UsedRange
here is another code i tried, actuelly with the help of a mrexcel thread
http://www.mrexcel.com/forum/excel-questions/9419-compare-list-b-add-records-b-not.html
here is my code,
Code:
Sub test()
Dim Rng1 As Range, Rng2 As Range, C As Range
Dim Z
With Sheets("Sent")
.UsedRange
Set Rng2 = Intersect(.UsedRange, .Range("A:A"))
For Each C In Rng2
With Sheets("Sales")
.UsedRange
Set Rng1 = Intersect(.UsedRange, .Range("B:B"))
Z = Application.Match(C, Rng1, 0)
If C = Rng1 Then
Rng1.Offset(0, 6) = C.Offset(0, 3)
End If
End With
Next C
End With
MsgBox "Done!"
End Sub
can anyone help me out?
i am really sick of working on that for weeks.