Hello
I try matching sheet report with sheet stock based on column B . if the items in columns C for sheet report is matched with sheet STOCK for column C , then will fill the items in colulm B for sheet report , and if it's not matched will keep empty some items are not the same thing .
in reality I use dictionary for make fast for simple data .
I got error mismatch in this line .
a(i, 2) = w(2)
here is the whole code
Sub test1()
Dim a, i As Long, ii As Long, ws As Worksheet, w, dic As Object
Set ws = Sheets("report")
Set dic = CreateObject("Scripting.Dictionary")
With Sheets("STOCK").Cells(1).CurrentRegion
a = .Value
For i = 2 To UBound(a, 1)
dic(a(i, 3)) = Application.Index(a, i, 0)
Next
With ws
With ws.Cells(1).CurrentRegion
a = .Value
For i = 2 To UBound(a, 1)
For ii = 2 To 3
Next
w = dic(a(i, 3))
If a(i, 2) = "" Then a(i, 2) = w(2)
dic(a(i, 3)) = w
Next
.Value = a
End With
End With
End With
End Sub
thanks