+ Reply to Thread
Results 1 to 9 of 9

How to get data from other Excel file

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Krakow, Poland
    MS-Off Ver
    Excel 2003
    Posts
    6

    Exclamation How to get data from other Excel file

    Hi, I don't know VBA, but I urgently need to have simply macro which works like:

    1. Get data from cells eg. B1-B20 from OTHER Excel file* (Sheet2)
    2. Insert these extracted data to active Excel document.

    *the name of the file is not constant - it has todays's date in a filename, eg. Document-21.12.2013.xlsx

    Could anybody please write steps above in efficient VBA code for Excel? Many thanks!

  2. #2
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,062

    Re: How to get data from other Excel file

    I used this, you can try it to see if it help you!
    Please Login or Register  to view this content.
    Last edited by john55; 12-21-2013 at 10:28 AM.
    Regards, John55
    If you have issues with Code I've provided, I appreciate your feedback.
    In the event Code provided resolves your issue, please mark your Thread as SOLVED.
    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

    ...enjoy -funny parrots-

  3. #3
    Registered User
    Join Date
    12-13-2013
    Location
    Krakow, Poland
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How to get data from other Excel file

    Thank you John! Code looks interesting and would be also useful. But I don't want to select a file manualy, I would like to make file extracted automatically in defined folder (the name of the file to import is not constant because it includes todays date). How to implement this rules to the code? Again thank you very much for all solutions!

  4. #4
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,062

    Re: How to get data from other Excel file

    You're welcome. I am sure someone else will help you!

  5. #5
    Registered User
    Join Date
    12-13-2013
    Location
    Krakow, Poland
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How to get data from other Excel file

    Does anybody has any idea/solution how to improve the code?

  6. #6
    Valued Forum Contributor xlbiznes's Avatar
    Join Date
    02-22-2013
    Location
    Bahrain
    MS-Off Ver
    Excel 2007
    Posts
    1,223

    Re: How to get data from other Excel file

    You need just change this line of @john55

    this
    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.
    change the folder path to the folder of your source file.
    Happy Computing ,

    Xlbiznes.

    To show your appreciation please click *

  7. #7
    Registered User
    Join Date
    12-13-2013
    Location
    Krakow, Poland
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How to get data from other Excel file

    Looks great! Thank you Xlbiznes!

  8. #8
    Registered User
    Join Date
    12-13-2013
    Location
    Krakow, Poland
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: How to get data from other Excel file

    Just one question. The code above (by john55) works great, but it closes file, from which data has been copied. I would like to not close the file. So I tried to delete the line:
    wbCopyFrom.Close SaveChanges:=False
    but when I delete the line, macro doesn't work. What can I do?

  9. #9
    Valued Forum Contributor john55's Avatar
    Join Date
    10-23-2010
    Location
    Europe
    MS-Off Ver
    Excel for Microsoft 365
    Posts
    2,062

    Re: How to get data from other Excel file

    the wkb remains open if you delete that line.

+ 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. Storing data from Userform to Shared Excel file wothout opeing the excel file.
    By d.balaji.naik in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-19-2013, 07:37 PM
  2. Replies: 0
    Last Post: 07-30-2012, 09:49 AM
  3. Replies: 6
    Last Post: 07-16-2012, 02:12 PM
  4. Replies: 1
    Last Post: 04-28-2006, 04:40 PM
  5. [SOLVED] Use ADO to transfer data from open excel file to closed excel file
    By JCanyoneer in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2005, 03:06 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