+ Reply to Thread
Results 1 to 11 of 11

Referencing Value from other workbook range for VLOOKUP function

  1. #1
    Registered User
    Join Date
    07-28-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    80

    Referencing Value from other workbook range for VLOOKUP function

    Hi Everyone,


    I have this code:
    Please Login or Register  to view this content.
    Is it possible that it will coded like this?

    Set Table2 = Workbooks(=range("B").value).Sheets(=range("C").value).Columns(range("G").value)
    and
    Cells(Imp_Row, Imp_Col) = Application.WorksheetFunction.VLookup(cl, Table2, =range("F").value, False)


    Thanks in advance

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,044

    Re: Referencing Value from other workbook range for VLOOKUP function

    Why not just use the regular vlookup function/formula?
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Referencing Value from other workbook range for VLOOKUP function

    Hi,

    Your suggestion is pretty much the answer
    Please Login or Register  to view this content.
    is the correct syntax- note that you must supply a row number for each range.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  4. #4
    Registered User
    Join Date
    07-28-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Referencing Value from other workbook range for VLOOKUP function

    Quote Originally Posted by FDibbins View Post
    Why not just use the regular vlookup function/formula?
    Hi FD,

    I want vba code because it has a lot of rows in the main report.

    Thanks.

  5. #5
    Registered User
    Join Date
    07-28-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Referencing Value from other workbook range for VLOOKUP function

    Quote Originally Posted by xlnitwit View Post
    Hi,

    Your suggestion is pretty much the answer
    Please Login or Register  to view this content.
    is the correct syntax- note that you must supply a row number for each range.
    Hi xlnitwit,

    There is no error in my whole code, however, it did not populate the data...

    Here's my whole code:
    Please Login or Register  to view this content.
    Also attach my sample files.
    Attached Files Attached Files

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Referencing Value from other workbook range for VLOOKUP function

    How could there be an error when you start all your routines with
    Please Login or Register  to view this content.
    The code should adjust for each row thus
    Please Login or Register  to view this content.
    note the other two workbooks need to be open.

  7. #7
    Registered User
    Join Date
    07-28-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Referencing Value from other workbook range for VLOOKUP function

    Xln,

    The code works on sheets 1 only of all file... other sheets like 2 and 3 didn't populate the data....

  8. #8
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Referencing Value from other workbook range for VLOOKUP function

    I don't know what you mean. There is no code to populate any other sheets.

  9. #9
    Registered User
    Join Date
    07-28-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Referencing Value from other workbook range for VLOOKUP function

    Quote Originally Posted by xlnitwit View Post
    I don't know what you mean. There is no code to populate any other sheets.
    Sorry for not being clear...

    I mean the data of Sheet("2") of FILE-A-Y1 and Sheet("2") and Sheet("3") of FILE-B-Y1 did not included in the Main Report..

  10. #10
    Registered User
    Join Date
    07-28-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Referencing Value from other workbook range for VLOOKUP function

    I've just got it...

    with this line:
    Please Login or Register  to view this content.
    Thanks all...

  11. #11
    Registered User
    Join Date
    07-28-2011
    Location
    Philippines
    MS-Off Ver
    Excel 2010
    Posts
    80

    Re: Referencing Value from other workbook range for VLOOKUP function

    One Problem, is there any way that it will not open the source workbooks before running the code? i have at least 12 workbooks to lookup...

+ 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. How to get the value from the other workbook using vlookup and cell referencing
    By krazyhype19 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-21-2014, 06:51 AM
  2. [SOLVED] Index Match Function Within One Workbook Referencing Cells in Another workbook error
    By Hackboss007 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 02-18-2014, 12:06 PM
  3. Vlookup problem referencing another workbook
    By wattsup in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-30-2012, 05:41 PM
  4. Replies: 1
    Last Post: 04-14-2010, 03:05 PM
  5. Vlookup and workbook sheet referencing in 2007
    By esupply in forum Excel General
    Replies: 4
    Last Post: 10-14-2009, 09:17 AM
  6. [SOLVED] VLOOKUP referencing another workbook
    By kleivakat in forum Excel General
    Replies: 2
    Last Post: 03-09-2006, 01:40 PM
  7. Referencing a range within a workbook
    By Peter Rooney in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-18-2005, 06:35 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