+ Reply to Thread
Results 1 to 4 of 4

VBA to vlookup into another workbook without opening said workbook

  1. #1
    Registered User
    Join Date
    02-15-2018
    Location
    London, England
    MS-Off Ver
    MS Office 2010
    Posts
    5

    VBA to vlookup into another workbook without opening said workbook

    Hi Excel folk!

    Hopefully someone can help with my request...!

    I have a workbook that I reference all the time with vlookups. Ideally, I would like to create a vba function that will stop me having to open the workbook all the time.


    For example, the data set has many columns of information. Column A has a list of Employee Numbers. Then columns B - M have various data about that employee (address, phone number, bank details, job title, salary etc etc).

    I would like the function to work so that if I type the employee number in a different workbook, it will return data from the column of my choosing. Basically, I want to create a fancy vlookup (through function or other VBA code) that will recognise the Employee ID then return the lookup with whichever number of columns I choose.

    Any help would be greatly appreciated!

    Thanks in advance,

    Heathy!
    Attached Images Attached Images

  2. #2
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: VBA to vlookup into another workbook without opening said workbook

    Hi, heathy.
    VLOOKUP does not work without opening the target workbook as far as I know.
    I think it's possible by using ADO to query the workbook via SQL, though.
    It is necessary to know the workbook's path and the sheet's name of the database.

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,595

    Re: VBA to vlookup into another workbook without opening said workbook

    If book path/name and sheet name are known, VLookUp should work in a cell

    something like
    =VLookUp(A1,'C:\test\[test.xlsx]sheet1'!A:B,2,False)

  4. #4
    Forum Contributor
    Join Date
    01-03-2018
    Location
    Fukuoka, Japan
    MS-Off Ver
    Excel 2013
    Posts
    123

    Re: VBA to vlookup into another workbook without opening said workbook

    If book path/name and sheet name are known, VLookUp should work in a cell

    something like
    =VLookUp(A1,'C:\test\[test.xlsx]sheet1'!A:B,2,False)
    Yes, it's true! I didn't know that! Thank you, jindon.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Opening a workbook from different location + Vlookup
    By subbby in forum Excel Programming / VBA / Macros
    Replies: 86
    Last Post: 05-02-2017, 09:29 AM
  2. Replies: 8
    Last Post: 10-15-2015, 07:55 AM
  3. [SOLVED] Opening new workbook and pasting values into current workbook - code issues
    By Stew1234 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-15-2014, 07:56 AM
  4. Copy data one workbook to another workbook without opening workbook
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-04-2014, 11:28 AM
  5. [SOLVED] Stop an excel workbook or worksheet from opening if workbook isn't in a certain folder
    By Raulus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-05-2013, 05:30 AM
  6. Opening Template as new workbook and not Blank Workbook from listbox
    By MB_vba in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-21-2013, 04:27 PM
  7. Opening & updating another workbook from an open workbook using a macro.
    By FV99 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-19-2012, 06:34 AM

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