Vlookup Excel Vba动态值

时间:2019-03-18 12:03:59

标签: excel vba vlookup

我正在尝试使用vba创建动态vlookup 请在下面的代码中查找并告诉我哪里出了问题,它会不断出现#VALUE错误

Sub ADO_Conn()
Dim conn As New Connection
Dim rs As New Recordset
Dim mee As String
Dim Rangerr As Variant
LASTIDX = Cells(Rows.Count, 1).End(xlUp).Row
    MsgBox LASTIDX
    For i = 2 To LASTIDX
    mee = Range("G" & i)

    Rangerr = ['C:\Users\ssalako\Documents\[xpress work 12.xlsx]xpr7thmarch'!$J:$P]

   Cells(i, 8).Value = Application.VLookup(mee, Rangerr, 2, 0)
Next i
         MsgBox "DATA LOADED"
End Sub

0 个答案:

没有答案