cruzrji1
04-22-2016, 02:52 PM
I´ve been struggling witht this for a while, please help...
I want to store range("F1:F3") as arr1, then store range ("A1:C100") as arr2, also have a third array called arr3, then I need to vlookup all the values for arr1 in arr2 and store the results in arr3, then write arr3 in range("H1:H3"). I need to do this in VBA and store the results as variables in another array, because I will perform more calculations based on the result of the vlookup, also this is as a test, actual values to vlookup and return results are about 4,000
so far...
sub looking()
dim arr1() as variant
dim arr2() as variant
dim arr3(1,3) as variant
arr1= range("F1:F3").value
arr2= range("A1:C100").value
for i=1 to 3
arr3(i,1)=worksheetfunction.vlookup(arr1(i,1),arr2,2,false)
next i
range("H1:H3").value=arr3
end sub
What is wrong with this?!
I want to store range("F1:F3") as arr1, then store range ("A1:C100") as arr2, also have a third array called arr3, then I need to vlookup all the values for arr1 in arr2 and store the results in arr3, then write arr3 in range("H1:H3"). I need to do this in VBA and store the results as variables in another array, because I will perform more calculations based on the result of the vlookup, also this is as a test, actual values to vlookup and return results are about 4,000
so far...
sub looking()
dim arr1() as variant
dim arr2() as variant
dim arr3(1,3) as variant
arr1= range("F1:F3").value
arr2= range("A1:C100").value
for i=1 to 3
arr3(i,1)=worksheetfunction.vlookup(arr1(i,1),arr2,2,false)
next i
range("H1:H3").value=arr3
end sub
What is wrong with this?!