Hi, I’m currently working on a macro using the vlookup function.</SPAN>
Vlookup formlula:</SPAN>
Workbooks: A)Parking_Template.xlsm – contains 55 columns (A,B….AJ……BC)</SPAN></SPAN>
B) EFMA_Template.xlsm- contains 8 columns (A,B</SPAN>,C,D,E,F,G</SPAN>,H</SPAN>)</SPAN>
Formula: </SPAN>"=VLOOKUP(AJ:AJ,'[EFMS _Template.xlsm]Sheet1'!$B:$H,6,FALSE)".</SPAN>
The formula looks at column “AJ” which is the lookup value, table array EFMS _Template.xlsm]Sheet1'!$B:$H, index to return 6, exact match.
</SPAN>
I would like to automate the process by coding a macro that uses the vlookup function.
Someone already assisted me a code snippet and I modified:</SPAN>
</SPAN>
I'm having an issue understanding the loop. The above code is not working correctly. Im new to programming and vba. Would someone please help me troubleshoot this issue?
Thanks..
Vlookup formlula:</SPAN>
Workbooks: A)Parking_Template.xlsm – contains 55 columns (A,B….AJ……BC)</SPAN></SPAN>
B) EFMA_Template.xlsm- contains 8 columns (A,B</SPAN>,C,D,E,F,G</SPAN>,H</SPAN>)</SPAN>
Formula: </SPAN>"=VLOOKUP(AJ:AJ,'[EFMS _Template.xlsm]Sheet1'!$B:$H,6,FALSE)".</SPAN>
The formula looks at column “AJ” which is the lookup value, table array EFMS _Template.xlsm]Sheet1'!$B:$H, index to return 6, exact match.
</SPAN>
I would like to automate the process by coding a macro that uses the vlookup function.
Someone already assisted me a code snippet and I modified:</SPAN>
- Sub FindVal()</SPAN>
- Dim x, lRow As Long</SPAN>
- lRow = Cells(Rows.Count, 1).End(xlUp).Row 'to find the last row</SPAN>
- On Error Resume Next</SPAN>
- For x = 1 To lRow</SPAN>
- Cells(x, 2) = Application.WorksheetFunction.VLOOKUP(Cells(x, 1), Workbooks("EFMA_template.xlsm").Worksheets("Sheet1").Range("B:H"), 6, False)</SPAN>
- Next x</SPAN>
- End Sub</SPAN>
I'm having an issue understanding the loop. The above code is not working correctly. Im new to programming and vba. Would someone please help me troubleshoot this issue?
Thanks..