+ Reply to Thread
Results 1 to 4 of 4

VBA external VLOOKUP instead of VLOOKUP-formula in cell

  1. #1
    Registered User
    Join Date
    11-04-2016
    Location
    Enschede, The Netherlands
    MS-Off Ver
    Office Professional Plus 2016
    Posts
    2

    Question VBA external VLOOKUP instead of VLOOKUP-formula in cell

    Initial situation:

    Workbook W1 with 1 sheet, WS1, containing the VBA-code
    Workbook W2 with 1 sheet, WS2, containing names and corresponding key-values (ibutton).

    The code I have written sofar relies on input from an Userform, containing a field named “Key” .
    The value of key is a string of digits representing the scan of a magnetic key-button (ibutton) read by a scanner. This keyvalue will be used in a VLOOKUP formula in WS1, to find the corresponding name.

    So far so good.

    In WS1 I have the input of the key-scanner stored in column A, while the VLOOKUP-formula in column B will retreive the corresponding name from WS2. Working like a charm, even when W2 is not opened.

    The change I am looking for:

    Instead of having the VLOOKUP-formula in column B, I want to use VBA to find the corresponding name in WS2 and put the value in column B… so no formula in B, just the result of the VLOOKUP.
    Preferably not having to open WS2.

    W2 is also used for other VLOOKUPs in other sheets, so I want to keep this WS2 as standalone source; so not having to copy it to other locations to minimize the risk of having several versions of it.

    Any help is much appreciated.

  2. #2
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Re: VBA external VLOOKUP instead of VLOOKUP-formula in cell

    ExcelBonk, I don't know how to do this w/o opening W2. But opening W2 (in read only) is not a big deal; the macro should execute fast and not disturb intregity of W2. Others may give you different (better) advice; see what other replies you get.
    Here is one way to do this. You will have to tweak for your other details. I know this is heavy on object definitions, but I reasoned that saving all these objects might come in handy when you add your other details. If not, then trim down this code.
    Holler if you have more questions.
    Please Login or Register  to view this content.
    Last edited by sauerj; 11-05-2016 at 09:57 AM.

  3. #3
    Registered User
    Join Date
    11-04-2016
    Location
    Enschede, The Netherlands
    MS-Off Ver
    Office Professional Plus 2016
    Posts
    2

    Re: VBA external VLOOKUP instead of VLOOKUP-formula in cell

    Hello sauerj,

    Apologies for the delay in reply. Your informaton put me on the right track. Some tweaking and trimming done; also adjusted some other code which had a same issue. Works neat!
    Thanx!!

  4. #4
    Forum Contributor sauerj's Avatar
    Join Date
    11-11-2009
    Location
    Lafayette, IN
    MS-Off Ver
    Excel 2019
    Posts
    163

    Re: VBA external VLOOKUP instead of VLOOKUP-formula in cell

    Cool! ... Take care!

+ 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. Vlookup - Link external filename to a cell and apply to formula?
    By Triniboy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 08-18-2014, 07:14 PM
  2. VLookup using cell value to reference an external sheet
    By AntonyInta in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-31-2014, 07:28 PM
  3. Vlookup, vlookup in external web Excel file
    By G.Bregvadze in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-15-2013, 02:10 AM
  4. VLOOKUP - reference an external table array using formula
    By ktcanuck in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 10-31-2012, 12:27 PM
  5. Replies: 5
    Last Post: 10-23-2012, 06:47 PM
  6. [SOLVED] Vlookup, External File Name to a Referenced Cell
    By gjohn282 in forum Excel General
    Replies: 2
    Last Post: 05-23-2011, 07:03 PM
  7. Replies: 1
    Last Post: 10-11-2010, 02:28 PM

Tags for this Thread

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