+ Reply to Thread
Results 1 to 9 of 9

Vlookup In Vba

  1. #1
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280

    Vlookup In Vba

    Hi everybody,

    I have the following code which is working perfectly on retrieving data from another sheet for VLOOKUP Wroksheet Function:

    Please Login or Register  to view this content.
    I want to develop this code to retrieve data from another workbook >> I tried the following code but it didn't work well with me >> it always gives me an error .. Can You please help me in this case??

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    03-23-2004
    Location
    London, England
    MS-Off Ver
    Excel 2019
    Posts
    7,079
    Letting us know what the error is would be a start
    Regards
    Special-K

    Ensure you describe your problem clearly, I have little time available to solve these problems and do not appreciate numerous changes to them.

  3. #3
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280
    When I activate the concern sheet >> error # 13 is appearing and the type of this error is mismatching >> and when I debug it >> the following line is highlighted

    Cells(C, 2) = Application.WorksheetFunction.VLookup(Cells(C, 1), ActiveWorkbook.Path & "\Test.xls" & Sheet1.[A2:B20], 2, 0)

    I think the problem with the path of the workbook Test >> in other words >> exactly with the following part:

    ActiveWorkbook.Path & "\Test.xls" & Sheet1

    Can you please check if this way of writing the path for a sheet in another workbook is correct or not.

    Thank you again.

  4. #4
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Could it be that you are only missing the exclamation mark !

    ActiveWorkbook.Path & "\Test.xls!" & Sheet1

    HTH
    Cheers
    Carim

  5. #5
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280
    It didn't work

  6. #6
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    try this:

    Please Login or Register  to view this content.
    Regards,
    Simon

  7. #7
    Registered User
    Join Date
    03-13-2006
    Posts
    47
    Simon,

    What did you mean with that?
    We are talking about Lookup in VBA environment not Excel.
    Thanks

    OverAC
    OverAC

    Excel for Vietnamese: www.giaiphapexcel.com

  8. #8
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Sorry, well just for arguments sake i meant to put something like
    Please Login or Register  to view this content.
    Regards,
    Simon

  9. #9
    Forum Contributor
    Join Date
    11-07-2005
    Posts
    280
    I reached the following code:

    Please Login or Register  to view this content.

+ 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