VBS Question - Variable as VLOOKUP Look_Up parameter? RRS feed

  • Question

  • Hi Folks -

    How do I use a variable as the lookup value for a vlookup formulae I'm inserting into a cell?

    Here is my code I'm trying but doesn't seem to work.  Is there a trick?

    	Dim strVlookup
    	strVlookup = objWorkbook1.Worksheets(FILE1TAB).Cells(6, strCol1).Value
    	objWorkbook1.Worksheets(FILE1TAB).Cells(6, strCol2).Value = "=IFERROR(VLOOKUP(" & strVlookup & ",'" & LOCALEXPORTPATH & "[" & FILE2 & "]" & FILE2TAB & "'!A:E,5,FALSE),"""")"


    • Moved by Alex-KSGZ Tuesday, October 16, 2018 5:33 AM
    Thursday, October 11, 2018 6:23 PM

All replies

  • Hi,

    According to your description, your issue is more related about VBS. And this forum is discussing and

    asking questions about the vb.net.

    Ask in the following forum.


    Thank you for your understanding.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    • Edited by Alex-KSGZ Friday, October 12, 2018 3:12 AM
    Friday, October 12, 2018 3:12 AM