+ Reply to Thread
Results 1 to 5 of 5

Copy Pasting data from one excel workbook to another using vba

  1. #1
    Registered User
    Join Date
    05-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Copy Pasting data from one excel workbook to another using vba

    Hi Guys,

    I'm a newbie at vba. I want to write a vba script that copies 73 cells from a specific row in an excel sheet and pastes them in a single column in 73 rows in a new document. It then goes back to the old document and copies 73 cells from the next row and pastes them in the new document.

    I want to do the following things using the macro

    1. Open a old.xls document
    2. Open a new new.xls workbook
    3. Copy a range of data from (D9:BX9) //73 cells from old.xls
    4. Paste the copied data from (D2:D74) in new.xls
    5. Go back to data.xls document
    6. Copy the range from (D10:BX10)
    7. Go back to new.xls (opened earlier) and pastes it in (D75:148)
    8. Continues in loop until it reaches an empty cell in data.xls
    9. Saves the new.xls and exits

    I'm trying to use a script I found online and modified a bit. I now just can't make it work. I would be much obliged if someone could help me with this.


    Script

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 05-10-2009 at 05:41 AM.

  2. #2
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Copy Pasting data from one excel workbook to another using vba

    HI
    try the following codes. change sheet name and workbook name if they are different.
    Please Login or Register  to view this content.
    Ravi

  3. #3
    Registered User
    Join Date
    05-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Copy Pasting data from one excel workbook to another using vba

    Ravi,

    Thanks for the reply. The code worked like a charm but with a slight glitch

    The cells D9 - BX9 are being copied and pasted to a new sheet,
    but instead of being pasted into the same row, one after the other, they are being posted on different rows. What I want is something like,

    The first 73 cells copied from D9 - BX9 get pasted from D2 - D74 of the new sheet and D10 - BX10 get pasted on D75- D147 and so on.

    Regards

    Wahaj

  4. #4
    Registered User
    Join Date
    05-08-2009
    Location
    USA
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Copy Pasting data from one excel workbook to another using vba

    The following code does the what I wanted to do, but takes a hell lot of time due to working cell by cell.

    Can someone help me in optimizing this baby,so that I can pick ranges instead of cell by cell?

    Please Login or Register  to view this content.
    Last edited by VBA Noob; 05-10-2009 at 05:41 AM. Reason: Added code tags

  5. #5
    Forum Contributor
    Join Date
    02-27-2008
    Posts
    764

    Re: Copy Pasting data from one excel workbook to another using vba

    HI
    try the following codes. Change the filename and sheet name to suit your case
    Please Login or Register  to view this content.
    Ravi

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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