VBA Vlookup to Changing Workbook Name

  • I'm trying to a vlookup in vba between 2 workbooks. The workbook I'm looking up information from will have a different name every day. How do I write the vlookup to reference the current active workbook (the sheet names will always be the same)?

    In my other code, I've being using Workbooks(2) as my reference but it doesn't seem to work in the vlookup.

  • Re: VBA Vlookup to Changing Workbook Name

    This is what I've tried:

    ActiveCell.FormulaR1C1 = _
    "=IFERROR(VLOOKUP(RC[-1],[' & workbooks(2) & ']Pivot Tables'!C4:C5,2,FALSE),0)"

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!