Consulting

Results 1 to 6 of 6

Thread: Copying to multiple workbook coding..

  1. #1
    VBAX Regular
    Joined
    Jun 2010
    Posts
    6
    Location

    Copying to multiple workbook coding..

    Hello..

    Can anyone help me with the following excel vba coding...

    I have three workbooks and what I need it to do is to look at sheet on worksheet one, look at columns A to U starting on row 7 and delete the the data down until in all cleared.

    Now it looks at workbook2 sheet1, look at columns A to U starting on row 7 and copies all the data down untill it gets to the a emplty row, thens paste this all this wookseet1. Then looks at worksheets2 sheet2, and copies the same as above into the next empty row in workbook1.

    It then looks at workbook3 and copies the same as workbook2 into workbook1....

    Does anyone have a idea on the coding for this task...

    Thanks inadvanced for the help on this ...

  2. #2
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    Have you tried to record these events using the macro recorder?
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  3. #3
    VBAX Regular
    Joined
    Jun 2010
    Posts
    6
    Location

    Copying to multiple workbook coding..

    Quote Originally Posted by Aussiebear
    Have you tried to record these events using the macro recorder?
    Thought of this but this but the issue is that it good for clearing the data on worksheet1, then copying to from the worksheet2 sheet1, but when copying from sheet2 it finding the next empty row after what been pasted from the first sheet1.

  4. #4
    Moderator VBAX Wizard Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    5,064
    Location
    I can't follow the logic of your reasoning in post #3. You've started to explain that you thought of this but this...... and then ramble on to the logic of the process. If you try to record the process by using the macro recorder, you then have some code to play around with. We then can look at your supplied code and amend where necessary until it works to your satisfaction. This is the logic behind my request.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

  5. #5
    VBAX Regular
    Joined
    Jun 2010
    Posts
    6
    Location

    Macro so far...

    Here is a copy of the macro created for my coding so far...


     
    Sub copyandpaste()
        Range("A3:U2000").Select
        Selection.ClearContents
        Windows("Service_Issue_Logv1.0_ABER.xls").Activate
        Sheets("unresolved").Select
        Range("A7:U30").Select
        Range("U30").Activate
        Selection.Copy
        Windows("DP_EOD_TREENDS_2010.xls").Activate
        Range("A3").Select
        ActiveSheet.Paste
        Windows("Service_Issue_Logv1.0_ABER.xls").Activate
        Sheets("resolved").Select
        Range("A7:U30").Select
        Range("U7").Activate
        Selection.Copy
        Windows("DP_EOD_TREENDS_2010.xls").Activate
        ActiveSheet.Paste
        Windows("Service_Issue_Logv1.0_ABER.xls").Activate
        ActiveWindow.Close
        Range("A7:U32").Select
        Range("U7").Activate
        Selection.Copy
        Windows("DP_EOD_TREENDS_2010.xls").Activate
        ActiveSheet.Paste
        Range("A77").Select
        Windows("Service_Issue_Logv1.0_ASTO.xls").Activate
        Sheets("resolved").Select
        Range("A7:U17").Select
        Range("U7").Activate
        Selection.Copy
        Windows("DP_EOD_TREENDS_2010.xls").Activate
        ActiveSheet.Paste
        Range("A88").Select
        Windows("Service_Issue_Logv1.0_ASTO.xls").Activate
        ActiveWindow.Close
        Range("A66").Select
    End Sub
    The issue from this are..

    1, I am selecting the range from my worksbooks manually but I will not know the range to paste because some days there are 2 rows to paste and the following day could be 20 rows so I need the marco to only copy the rows that have data in..

    2, When pasting into the main workbook I need to look for next empty row to copy the pasted data into.

    Hope this make more sense and thanks for your help.

  6. #6
    Moderator VBAX Guru Simon Lloyd's Avatar
    Joined
    Sep 2005
    Location
    UK
    Posts
    3,003
    Location
    Perbags, please read the link in my signature with regards crossposting!

    Crossposted at least here http://www.excelforum.com/excel-prog...ml#post2325937
    Regards,
    Simon
    Please read this before cross posting!
    In the unlikely event you didn't get your answer here try Microsoft Office Discussion @ The Code Cage
    If I have seen further it is by standing on the shoulders of giants.
    Isaac Newton, Letter to Robert Hooke, February 5, 1675 English mathematician & physicist (1642 - 1727)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •