+ Reply to Thread
Results 1 to 2 of 2

VB script for "dynamic" VLOOKUP

  1. #1
    Registered User
    Join Date
    04-21-2011
    Location
    Amsterdam, Netherlands
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    2

    VB script for "dynamic" VLOOKUP

    Hi,
    I am new to VBA and appreciate your help

    In directory D:\SourceFile there are a great number of source files.
    In my Summary spreadsheet the values in column B indicate the source file name(=number.xls) that is needed.
    I would like to place my cursor in a cell in column C and start a macro that will do the following: (1) Lookup the value from the cell in column A (2) in the sourcefile with the name that is in the cell in column B. [the source files are closed and working with indirect.ext does not work]

    What I have so far is not working:

    Sub PullFromSourceFile()
    '
    ' Keyboard Shortcut: Ctrl+i
    '
    ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-1],'D:\SourceFile\["B2".xls]PriceInfo'!R2C2:R15000C5,2,0)"

    End Sub
    Attached Files Attached Files

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,142

    Re: VB script for "dynamic" VLOOKUP

    Try:

    Please Login or Register  to view this content.


    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1