Hi Chandoo,
i need an help with vba code for vlookup to multiple sheets.
Please find the below vba code which i have applied for 1 sheet & i need to apply the same to code to multiple sheets with output to different ranges.
For Eg: Column A:A i have multiple containor Id's & i need to put vlookup for 4 sheets which have containor id's in column M:M & out put of the vlookup has to appear in column B:B, C:C, D:D respectivelly untill column A:A is blank.
Kindly help with this.
----------------------------------------------------------------------------
Mod Edit: Code Tags added!
i need an help with vba code for vlookup to multiple sheets.
Please find the below vba code which i have applied for 1 sheet & i need to apply the same to code to multiple sheets with output to different ranges.
For Eg: Column A:A i have multiple containor Id's & i need to put vlookup for 4 sheets which have containor id's in column M:M & out put of the vlookup has to appear in column B:B, C:C, D:D respectivelly untill column A:A is blank.
Kindly help with this.
Code:
Sub Addf()
Application.ScreenUpdating = False
Mano = ActiveWorkbook.Name
ActiveSheet.Next.Select
A = ActiveWorkbook.Name
Workbooks(Mano).Activate
Range("A2").Select
Workbooks(A).Activate
Cells.Select
Range("M1").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Set Manoj = Selection
ActiveSheet.Previous.Select
Range("B2").Select
C = 2
Do Until Cells(C, 1).Value = ""
TOID = Cells(C, 1).Value
If IsError(Application.VLookup(TOID, Manoj, 1, 0)) Then
D = "N/A"
Else
D = Application.WorksheetFunction.VLookup(TOID, Manoj, 1, 0)
Cells(C, 2).Value = D
End If
C = C + 1
Loop
Cells.Select
Columns.AutoFit
Application.ScreenUpdating = True
Range("D1").Select
MsgBox ("Request Done")
End Sub
----------------------------------------------------------------------------
Mod Edit: Code Tags added!
Attachments
Last edited by a moderator: