I have a 2D-Array and I want to look up for values in the column.
My 2D Arrays contains the names and values.
If my arrDestination Array match with Column A then I want to insert the Values in B.
So for example:
VBA Code:
arrDestination(0, i) = Name(i) (asdfg, csda, asdfg,zzz)
arrDestination(1, i) = Values(i) (100, 50, 100, 60)
My 2D Arrays contains the names and values.
If my arrDestination Array match with Column A then I want to insert the Values in B.
So for example:
- arrDestination(0,0) = asdfg MATCH with Column A, then insert 100.
- arrDestination(0,3) = zzz DOES NOT MATCH with Coulm A, insert "empty"
VBA Code:
For i = 0 To UBound(arrDestination, 2)
vData = Sheets("half").Range("A1:A4").value
s = arrDestination(0, i)
myVar = Application.VLookup(s, vData, 2, 1)
Next i
A | B | |
---|---|---|
1 | asdfg | 100 |
2 | csda | 50 |
3 | asdfg | 100 |
4 | gfs | empty |