+ Reply to Thread
Results 1 to 14 of 14

VLook-UP using VBA - across multiple workbooks

Hybrid View

  1. #1
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    VLook-UP using VBA - across multiple workbooks

    Hi
    Trying to use vlook up function to pull data from one workbook to another workbook.

    Workbook1: Lookup Value is in B2
    Workbook2:contains the table array of '[Workbook2.xlsx]Sheet1!$G$:$H$
    Workbook2:Col_Index_num = 2
    VLookup Range LookUp:False

    Need to find match betweek wb1 b2 and wb2 G and pull the value in wb2 H over to wb1 starting in column E2 and autofill the remaining rows of column E with the value of wb2 H if match is found otherwise enter the message "no records found".



    I tried this as a test but had no luck
    (only did this in one workbook, just to see


    Dim Res As Variant
    On Error Resume Next
    Err.Clear
    Res = Application.WorksheetFunction.VLookup(b2, Range("g2:h40"), 2, False)

  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,093

    Re: VLook-UP using VBA - across multiple workbooks

    Dim Res As Variant
    On Error Resume Next
    Err.Clear
    Res = Application.WorksheetFunction.VLookup(Range("b2"), Range("g2:h40"), 2, False)
    But you need to fully qualify the ranges with workbook and sheet references.


    Regards, TMS
    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


  3. #3
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: VLook-UP using VBA - across multiple workbooks

    Thanks Trevor Ill give a shot

  4. #4
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: VLook-UP using VBA - across multiple workbooks

    Hey Trevor,
    How could I modify this so to autofill column E with the results. Also If #N/A is the returned value how to I change this to equal "!! N0 B2B Status Found !! in dark blue.

    Bob

  5. #5
    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,093

    Re: VLook-UP using VBA - across multiple workbooks

    You're welcome. Thanks for the rep.

  6. #6
    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,093

    Re: VLook-UP using VBA - across multiple workbooks

    Please post a sample workbook so I can see the worksheet.

    Regards, TMS

  7. #7
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: VLook-UP using VBA - across multiple workbooks

    Thanks Trevor - I uploaded the two files -- Thanks again -Really be glad to close this project learned alot though. Appreciate your support

  8. #8
    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,093

    Re: VLook-UP using VBA - across multiple workbooks

    I uploaded the two files

    Where exactly? Not that many places to look, and I've looked in them ...

  9. #9
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: VLook-UP using VBA - across multiple workbooks

    Hi Trevor
    Are you saying you didn't see them .. Thought I sent as attachments.. What is the best way to get them to you..

  10. #10
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: VLook-UP using VBA - across multiple workbooks

    Hi Trevor,
    Uploaded the files again. Sorry for that it appears one was too large last night.

    Thanks again for your time and for your patience on this.

    Bob

  11. #11
    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,093

    Re: VLook-UP using VBA - across multiple workbooks

    Thought I sent as attachments.. What is the best way to get them to you..
    I don't know where they've gone but they haven't arrived with me. So, sent as attachments where?

    Best way is to upload them to the thread so everyone can see them.

    To attach a sample workbook: Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic

  12. #12
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    Unhappy Re: VLook-UP using VBA - across multiple workbooks

    Hi Trevor,
    I checked Manage Attachments and I see them there. I am not sure I understand why you are not seeing them.

    I will use a manual technique for the vlook up which I was hoping to avoid .






    Bob

  13. #13
    Registered User
    Join Date
    02-19-2013
    Location
    Massachussetts
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: VLook-UP using VBA - across multiple workbooks

    Hi Trevor
    Any luck seeing the files ?

  14. #14
    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,093

    Re: VLook-UP using VBA - across multiple workbooks

    No. Let's take it off line. I'll PM you.

    Regards, TMS

+ 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