+ Reply to Thread
Results 1 to 18 of 18

I need a macro for copying the data of all excel files into one sheet of a excel file.

  1. #1
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Thumbs up I need a macro for copying the data of all excel files into one sheet of a excel file.

    hey guys i am having 8 to 12 excel files i need all the data of those excel files in a folder to paste in a single excel file in single sheet

  2. #2
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    So the data should be copied one below the other right?

    Do you want the filename to be shown, to reflect from which file the data was copied?

    Do the source files have only 1 sheet with data or multiple sheets per file?

    What is the last column containing data?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  3. #3
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    I have 8 to 12 excel files with single sheet and I want to merge all those files into one excel file with 1 tab

    Yes the data should be copied one below the other

    Yes i want the file name to be shown, to reflect from which file the data was copied

    Yes the source files have only 1 sheet

    The last column contains also the data for example

    hzn6l5:x:21423:21019:Srinivas Kanduri:/model/adr_home/hzn6l5:/bin/sh
    tz61kf:x:21424:21019:Satish Padiyar:/model/adr_home/tz61kf:/bin/sh
    rzd766:x:21425:21019:Michael Sullivan:/model/adr_home/rzd766:/bin/sh
    zz04np:x:21078:21019:Todd Justman:/model/adr_home/zz04np:/bin/sh
    wzmbqc:x:21079:21019:Padmapriya Rajagopalan:/model/adr_home/wzmbqc:/bin/sh
    pz8y5p:x:21085:21019:Nassima Chafai:/model/adr_home/pz8y5p:/bin/sh

  4. #4
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    In the last question, i meant to ask the column address of the last column having data. Like column M or column X.

  5. #5
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Hey these are the sample files

    Thanks
    Attached Files Attached Files

  6. #6
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Your data is all in column A. Do you want the data to be split into columns after consolidation?

  7. #7
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    I think its better if u think column X is the last one.

    Yes that would be gr8 if it splits after consolidation or else i will do it manually as per my requirement if i need a code that to merge or append all the files into on xl sheet .
    And it would be gr8 if u have gven me the steps how to add the code into a excel sheet

    Thanks
    Last edited by pavan_yuvaraj; 10-15-2012 at 10:19 AM.

  8. #8
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    But how column X? All your data is in column A.

  9. #9
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    yes All our data will be in column A only

    can u help me on this macro
    Last edited by pavan_yuvaraj; 10-15-2012 at 11:09 AM.

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Try this code
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose Tools | Macro | Macros
    Select a macro in the list, and click the Run button
    Last edited by arlu1201; 10-16-2012 at 10:58 AM. Reason: Added missing variables.

  11. #11
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Hey thanks for sending me the code and i am getting the following error

    do u want me to place all the files in one folder.

    and do u want me to change the path in code

    Please mark in red what is to be changed?

    Thanks for ur quick reply.....

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    What error are you getting?

    Yes, all files should be placed in one folder. Change the path i have marked bold in the code above.

  13. #13
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Hi,
    i have changed the path and this is the screen shot so pease help me in this regard and i kept all the files in a fder as u said.
    Attached Images Attached Images

  14. #14
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Sorry about that. I have edited the code in post 10 to reflect the changes.

    Please try it now and let me know.

  15. #15
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Thanks for editing but now i am getting this error and its not getting consolidated

    i am doing as per this document, please let me know wether this flow is correct or not.
    Attached Files Attached Files

  16. #16
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    U dont need to open the source files. The macro will open, copy and close each file. Only open the file containing the macro and run it. Ensure that the macro file is not in the same folder as the other files.

  17. #17
    Registered User
    Join Date
    10-15-2012
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    Hey Arlette,

    I have success fully able to execute the code thanks for the help,

    Its Really a very quick response and u have helped me a lot,

    Thank you so much for helping me.

    Urs Pavan..

  18. #18
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: I need a macro for copying the data of all excel files into one sheet of a excel file.

    @ pavan_yuvaraj

    Welcome to the forum.

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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