vlookup from another workbook code example
Example: vba code to vlookup from another workbook
Sub test()
Application.ScreenUpdating = False
Dim sw As Workbook
Dim dw As Workbook
Dim srng As Range
swname$ = "BB_Finacle ID-Mar'19.xlsb"
swpath$ = ThisWorkbook.Path & "\" & swname
Set dw = ThisWorkbook
c& = Sheet1.Cells(Rows.Count, 1).End(xlUp).Row
Workbooks.Open (swpath)
Set sw = Workbooks(swname)
Set srng = sw.Sheets(1).Range("B:R")
Sheet1.Range("B2:B" & c).Formula = "=VLookup(A2,[BB_Finacle ID-Mar'19.xlsb]SHEET1!" & srng.Address & ", 3, False)"
Sheet1.Range("B2:B" & c).Copy
Sheet1.Range("B2").PasteSpecial xlValues
Application.CutCopyMode = False
sw.Close
Application.ScreenUpdating = True
End Sub