我试图编写在数组上执行vlookup的代码。这就是我现在所拥有的:
sub test()
Dim SrcRange As Variant
Dim look as Integer
Dim row_ct as Integer
row_ct = Sheets("Index").Range("A1").End(xlDown).Row
Set SrcRange = Sheets("Index").Range(Cells(1,1), Cells(row_ct,3)
look = Application.Vlookup("Tier 1",SrcRange,3)
End Sub
以下是该表的示例:
Tier Amount Location Indicator
Tier 1 1500 4
Tier 2 1200 6
Tier 4 13000 5
Tier 5 1200 7
出于某种原因,无论我把我的搜索标准放在什么位置,"看起来"变量总是出现为2.即使我搜索不在第一列中的范围。我确信有什么合理的理由,我无法弄明白。