+ Reply to Thread
Results 1 to 5 of 5

copy specific cells from multiple .xlsx files into a table in destination file

  1. #1
    Registered User
    Join Date
    10-06-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    8

    copy specific cells from multiple .xlsx files into a table in destination file

    I have multiple .xlsx files, and I want to copy specific cells on column M from each file and combine them into one table on a destination file “gettotals.xlsm”

    I have attached copies of sample .xlsx files as well as the “gettotals.xlsm”

    My codes are as follows:

    Please Login or Register  to view this content.
    The macro ran into error at line “Workbooks.Open (Filepath & MyFile) and I have no clue how to fix the bug.

    Shall appreciate if someone can help me make this macro work.

    Thank you very much!
    Henry
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: copy specific cells from multiple .xlsx files into a table in destination file

    Try this...

    Please Login or Register  to view this content.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Registered User
    Join Date
    10-06-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    8

    Re: copy specific cells from multiple .xlsx files into a table in destination file

    Dear AlphaFrog

    The code works perfectly standalone. Thank you very much.

    I started with a bunch of raw csv files, which I used a separate macro to trim some columns, rename some headers, do some calculations, etc, and finally came up with the .xlsx files which your code was run against. This means I have to run 2 macros now to get my final file.

    Codes for my existing macro is as follows:
    Please Login or Register  to view this content.
    How do I merge the 2 macros into one? Much appreciate if you could help me out again.

    Thanks very much
    Henry
    [I just started learning vba, so if you could bear with me asking for help. And by the way, can you recommend a good book where I can learn all the basic skills? Thanks]

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: copy specific cells from multiple .xlsx files into a table in destination file

    You're welcome.

    This code is not tested.

    Please Login or Register  to view this content.
    I don't have a book recommendation.

  5. #5
    Registered User
    Join Date
    10-06-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2010
    Posts
    8

    Re: copy specific cells from multiple .xlsx files into a table in destination file

    Thanks for all the help. I am so excited that it is doing exactly what I want it to do. Thanks again

+ 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. Replies: 3
    Last Post: 01-05-2014, 05:50 AM
  2. Replies: 0
    Last Post: 03-13-2013, 09:08 PM
  3. Copy specific cells from many files into master file
    By cmgst49 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2012, 03:05 PM
  4. How to add the columns data of several xlsx files of a folder in another xlsx file
    By ravikumar00008 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-25-2012, 04:29 AM
  5. Replies: 4
    Last Post: 09-22-2010, 01:22 PM

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