我有以下脚本,但出现 VLOOKUP 错误:
Dim DataRange, LookupRange As Range
Dim Data, Test As Variant
Set DataRange = Sheets("sheet").Range("A1:K12000")
Set LookupRange = sheets("sheet2").Range("A1:C50")
Data = DataRange.Value
For i = LBound(Data, 1) To UBound(Data,1)
ReDim Preserve Test(1 To 3, 1 To i)
test(1, i) = Application.WorksheetFunction.VLookup(Data(i, 4), LookupRange, 3, 0)
'Other stuff works fine
Next i
不幸的是,我收到错误说明:
"Unable to get the VLookup property of the WorksheetFunction class"
这很奇怪,因为所有变量和范围在监视模式下看起来都很好。查找也是按字母顺序排列的......有什么想法吗?