+ Reply to Thread
Results 1 to 4 of 4

How do I split up data and copy it to a new workbook?

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    How do I split up data and copy it to a new workbook?

    I have a table with the Columns: Date, Col1, Col2, Col3.

    I want to copy all the rows with the same date into a new workbook. The date is in order. I have a code written that works. However, it takes forever to run, because it is looping through each row. I have A LOT of rows.

    Is there no way to just select and copy a chunk and then paste it all just once? I think it takes long because it is pasting each individual row separately.

    Thanks.

    Here is my code:

    Please Login or Register  to view this content.
    Last edited by bananajelly; 08-21-2014 at 03:39 PM. Reason: Clarification.

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: How do I split up data and copy it to a new workbook?

    Hi Nanner,

    Try:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    California, United States
    MS-Off Ver
    Excel 2010
    Posts
    49

    Re: How do I split up data and copy it to a new workbook?

    xladept, the code you wrote only copied/pasted one row. But when I changed the Range("A2") to Range("A2:A400"), it worked fine. However, I need something where I can add a changing variable.


    For example, if n = total rows = 400, I have tried

    Range("A2:A" & n &) and
    Range(Cells(2,1), Cells(400, 1))

    But I get an error for both.

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: How do I split up data and copy it to a new workbook?

    Try:

    Please Login or Register  to view this content.
    That code has worked on other jobs???

+ 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. [SOLVED] Split workbook into multiple workbooks based on data
    By rlsublime in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-07-2014, 12:26 AM
  2. Split and Extract data from master workbook into several other workbooks
    By kezzyk in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-29-2013, 01:00 AM
  3. [SOLVED] Split data into different worksheets in a new workbook.
    By fdotlix in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-31-2012, 07:01 PM
  4. [SOLVED] Split Macro modification to Split into new Workbooks instead of sheets within one workbook
    By DLSmith in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-13-2012, 08:11 PM
  5. Replies: 1
    Last Post: 04-01-2006, 03:50 PM

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