Code:
Hi Team,
plz help, I am trying to apply vlookup up formula. but its throwing error on both the formula,
plz assist , where I am doing wrong. Thanks.
Sub vlookuptesting()
Dim wbk As Workbook
Set wbk = Workbooks.Open(ThisWorkbook.Worksheets("sheet1").Range("b5").Value)
Dim ws As Worksheet
Set ws = wbk.Worksheets("sheet1")
Dim myrange As Range
Set myrange = ws.Range("a1").CurrentRegion
ThisWorkbook.Activate
ThisWorkbook.Sheets("sheet2").Range("h7").Formula = "=vlookup(G7,"[" & wbk.Name & "]" & ws.Name & "!" & myrange & ",2,0)"
ThisWorkbook.Sheets("sheet2").Range("h7").Formula = "=vlookup(G7,[" & wbk.Name & "]" & ws.Name & "!" & myrange & ",2,0)"
End Sub
Regards,
Mallesh