+ Reply to Thread
Results 1 to 7 of 7

VBA Macro code - import data from another workbook (VLOOKUP)

  1. #1
    Registered User
    Join Date
    12-05-2013
    Location
    Romania
    MS-Off Ver
    Excel 2010
    Posts
    19

    VBA Macro code - import data from another workbook (VLOOKUP)

    Hello,

    I am still new to vba, and i need your help.

    Can you please help me with a macro VBA code (in file A) for importing data from another workbook (file B).

    The original formula that I have at this moment is:

    Formula: copy to clipboard
    Please Login or Register  to view this content.
    .
    .
    .
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    - import items from different columns.

    Both file are saved in the same folder, and open.

    I have now found the following code...it works for column B (In file A) ... but how to do it for the other columns?

    Please Login or Register  to view this content.

    The original files, on which I want to use this vba code has more than 10 000 rows. As attachment only some samples.

    Thank you in advance for your help.

    Madi1004
    Attached Files Attached Files

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA Macro code - import data from another workbook (VLOOKUP)

    It is probably not super-fast code, but it sees it cam be working one.
    So I am not suggesting a new one but just improving the existing one.
    The equivalent to thitd argument in VLOOKUP is here
    Please Login or Register  to view this content.
    This offset 3 (columns) means the same as 4th column in your first formula.
    So you can ammend your Findingname function to be more universal one by adding a second argument
    Please Login or Register  to view this content.
    and call it several times:
    Please Login or Register  to view this content.

  3. #3
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA Macro code - import data from another workbook (VLOOKUP)

    or another way:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    12-05-2013
    Location
    Romania
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: VBA Macro code - import data from another workbook (VLOOKUP)

    Thank you for your help.

    You are right, this code is very slow. Do you have one that is faster?

  5. #5
    Registered User
    Join Date
    12-05-2013
    Location
    Romania
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: VBA Macro code - import data from another workbook (VLOOKUP)

    I am a beginner in VBA.
    Using the above code i get an error in the line
    Please Login or Register  to view this content.
    Can you please help me!

    Thank you

  6. #6
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,864

    Re: VBA Macro code - import data from another workbook (VLOOKUP)

    If you are using this version of FindingName function:
    Please Login or Register  to view this content.
    you cannot use
    Please Login or Register  to view this content.
    to call it. You have to use 2 arguments - sname and kolumn to be returned number.

  7. #7
    Registered User
    Join Date
    12-05-2013
    Location
    Romania
    MS-Off Ver
    Excel 2010
    Posts
    19

    Re: VBA Macro code - import data from another workbook (VLOOKUP)

    Hello,

    Thanks once again for your help. The import of data is functioning, but some prices are wrong (please see attachment - last column cells marked with red). The source workbook(file B) is in the first post.

    Do you have a solution for this?

    Thank you,
    madi1004
    Attached Files Attached Files

+ 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. Modify exiting Macro Export data from multiple workbooks and Import into 1 Master workbook
    By SerenitynWisdom in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2013, 11:55 PM
  2. Macro to Import Data from Closed Workbook to CSV File
    By groundin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2013, 09:39 PM
  3. code to import data from a closed workbook
    By jeepguy8794 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-27-2011, 05:44 PM
  4. Code efficiency: Import data (vlookup)
    By abousetta in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 11-16-2011, 04:32 PM
  5. Help on macro code - import *.CSV data from WEB
    By FerVerX in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-24-2008, 11:10 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