我正在尝试将Vlook从一张纸张用到另一张纸张。宏将打开目标文件(Stock_Final),然后使用for函数将相应的值放在主表(DV2.5028)中
我已经编写了下面的宏但是它给了我以下错误'无法获取工作表函数类的Vlookup属性
Sub LookupValues()
Dim colI_Cell As Long
Dim colI_Range As Range
Dim rngLookupRange As Range
Dim rngFound As Range
Dim wb As Workbook
Dim Val As Integer
Dim i As Integer
Dim Sht As Worksheet
ThisWorkbook.Worksheets("Sheet1").Activate
colI_Cell = Range("A1").CurrentRegion.Rows.Count
Set wb = Workbooks.Open("C:\Users\vpd702450\Desktop\New folder\Stock_Final", True, True)
Set rngLookupRange = wb.Worksheets("Stock_Final").Range("B7:F20000")
For i = 2 To colI_Cell
Cells(i, 49) = Application.WorksheetFunction.VLookup(Cells(i, 2), rngLookupRange, 5, False)
Next i
End Sub
提前致谢。