Wildcard vlookup in arrays - VBA

Viewed 94

I have a problem to vlookup values from one array into another.

Arrays are:

enter image description here


enter image description here

My code results in Error 2042:

Dim arr9 As Variant
ReDim arr9(LBound(arr7) + UBound(arr7))
i = 0
For i = LBound(arr7) To UBound(arr7) Step 1
arr9(i) = Application.VLookup(Left(arr7(i), 5) & "*", Arr, 1, 0)
Next i

enter image description here

What I need is to find items from arr7, i.e. arr7(0) = zch20 in Arr and assign corresponding value from arr to arr9. Just first 5 characters need to be vlookuped since they are mutual characters for both arr and arr7 but full name string needs to be inserted to arr9.

Thank you.

1 Answers
Related