Ask Experts Questions for FREE Help !
Ask
    n_hollingdale's Avatar
    n_hollingdale Posts: 1, Reputation: 1
    New Member
     
    #1

    Feb 12, 2008, 03:40 AM
    Macro coping data from many workbooks into one
    Hello,

    Please could someone help me?
    I need to write a macro that will open up a folder containing over 3000 workbooks, copy the data from each workbook and paste the data into a new workbook.

    How can I get the macro to copy the data from the first workbook into a new workbook and then copy the data from the next workbook and paste it below the data that was just copied across?

    Is there a loop that can be used in order to do this?

    Any help would be very much appreciated.

    Thank you
    ScottGem's Avatar
    ScottGem Posts: 64,966, Reputation: 6056
    Computer Expert and Renaissance Man
     
    #2

    Feb 12, 2008, 07:11 AM
    This would be a failry complex VBA module to loop through the directory, use Office Automation to open and copy the contents, then paste it into the current sheet. The actual positioning the cursor for the paste is one of the easiest pieces.

    However, my Excel VBA skills are not up to this task. So if no one else answers I would suggest posting this at utteraccess.com. There are a few Excel MVPs who monitor the Excel board there.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #3

    Feb 12, 2008, 10:18 AM
    Do the 3000 other workbooks change names or are they always the same named documents? If so, you could do this yourself pretty easily.

    ChDir "C:\Documents and Settings\Jerry2\My Documents\ExcelDocs"
    Workbooks.Open Filename:= _
    "C:\Documents and Settings\Jerry2\My Documents\ExcelDocs\WORKBOOK1.xls"
    Range("B2:C4").Select
    Selection.Copy
    Windows("MAINWORKBOOK.xls").Activate
    Range("A6").Select
    ActiveSheet.Paste
    Application.CutCopyMode = False
    Windows("WORKBOOK1.xls").Activate
    ActiveWindow.Close
    (now repeat this for the next workbook and range.)

    Down and dirty but would work. There are some VB tricks to probably shorten the whole macro, power tricks.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #4

    Feb 12, 2008, 10:23 AM
    Another way is to simply reference in the MAINWORKBOOK cells that refer to data in the other sheets. If that data being copied over is in the same place all the time, this is probably the easiest method.

    This is called LINKING and the help files in Excel show the easiest examples:

    Link
    In A1
    =('C:\Reports\[Budget.xls]Annual'!C10)
    In B1
    =('C:\Reports\[Budget.xls]Annual'!C11)

    ... etc.

    That format includes the full path, the doc name in [brackets],the name of the sheet in the workbook, and then the cell reference.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Data entry or data processing from home. [ 1 Answers ]

Hello from Florida, My name is Don and I am looking for a free data entry from home website that I can find. It is not easy to find! Please help!

Coping with bullies [ 5 Answers ]

At school some (well lots) people are mean to me. I have a few friends but a majority of people just tease me or talk behind my back. There is one girl, she joined school just this year, at first I thought she was nice, but then she had her little group of friends and a few peple who I considered...

Re-tile and new coping [ 2 Answers ]

Hello- Gunite pool repair help seems to be minimal on the web. I would like to know if replacing both coping and tile what to do first, the coping or the tile and why? Thanks

Coping DVDs [ 3 Answers ]

I have a CD burner and a DVD burner I also have Nero, Burn4 Free and Any DVD, Clone 2 and WinMx I still am unable to burn a DVD. I can copy from one to another but I can not burn from DVDs downloaded from WinMx. Any DVD said I needed a patch but I am new to all of this and I need help:eek: Thanks...

.coping like a moron. [ 1 Answers ]

Welll Ill post this "question" here and hope that this is where it actually belongs. I have in the past wrote questions based on my tromatice past, and this one well relates but won't get into the past details. With my past destroying so much of me, and me being the stubbern person I am, I've...


View more questions Search