我试图在我的vba代码中使用VLOOKUP函数在一个表格阵列中查找一个值。 我不知道怎么写才正确。
下面是正常的VLOOKUP公式和所有的引用。
=VLOOKUP(DATA!AN2,DATA!AA9:AF20,5,FALSE)
请看下面 "Vlookup "的代码。
Function vlookupVBA(lookupValue, rangeString, colOffset)
vlookupVBA = "#N/A"
On Error Resume Next
Dim table_lookup As range
Set table_lookup = range(rangeString)
vlookupVBA = Application.WorksheetFunction.vlookup(lookupValue, table_lookup, colOffset, False)
End Function