+ Reply to Thread
Results 1 to 5 of 5

How do I select and copy ranges of about 5000 rows based on sets of criteria?

  1. #1
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Exclamation How do I select and copy ranges of about 5000 rows based on sets of criteria?

    I have a spreadsheet into which I have to regularly paste up to 5000 rows of varying data. The column headings are always the same and the Criteria I'm sorting by is always the same. I am trying to write a macro to sort the data by the criteria, then copy and paste each block into a separate tab.

    I am providing a sample of spreadsheet that shows approximately how the original one is.

    The macro needs to complete the following tasks.


    - "currently open" tab: copy the titles (1st row) and all rows with Status "Open" on the tab "All" and move them.

    - "xV-currently open" tab: same as what is done for "currently open" tab, but the rows with the Agent "Vesta" needs to be excluded

    - "CurOpen - Created prior to 2002" tab: on the worksheet "All", copy the titles (1st row), copy all rows with Status "Open" and created prior to 2002 (column H)

    - "xV-CurOpen-Created prior 2002": same as what is done for "CurOpen - Created prior to 2002" tab, but the rows with the Agent "Vesta" needs to be excluded

    - "CurOpen - Created in 2002" tab: on the worksheet "All", copy the titles (1st row), copy all rows with Status "Open" and created in 2002 (column H)

    - "xV-CurOpen-Created in 2002" tab: same as what is done for "CurOpen - Created in 2002" tab, but the rows with the Agent "Vesta" needs to be excluded

    - "Opened and closed in 2002" tab: on the worksheet "All", copy the titles (1st row), copy all rows with Status "closed" and created in 2002 (column H)

    - "xV-Opened and closed in 2002" tab: same as what is done for ""Opened and closed in 2002" tab, but the rows with the Agent "Vesta" needs to be excluded

    - "Closed in 2002" tab: on the worksheet "All", copy the titles (1st row), copy the rows with closed date (column I) in year 2002.

    Let me know if you have any questions.

    Thanks for your help.
    Attached Files Attached Files
    Last edited by dasseya1; 09-05-2013 at 10:06 PM.

  2. #2
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: How do I select and copy ranges of about 5000 rows based on sets of criteria?

    Can anyone help me on this?

    Thank you.

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

    Re: How do I select and copy ranges of about 5000 rows based on sets of criteria?

    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 View | Macros
    Select a macro in the list, and click the Run button
    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]

  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: How do I select and copy ranges of about 5000 rows based on sets of criteria?

    Do let me know if you want the destination sheets to be cleared each time you need to run the macro.

    Also a check can be put in place if the sheet exists, if it doesnt, then create the sheet.

    Another check can be put in place to see if the header exists, if it doesnt, only then copy it.

  5. #5
    Registered User
    Join Date
    08-14-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: How do I select and copy ranges of about 5000 rows based on sets of criteria?

    The macro code works fine. That's exactly what I was looking for.

    Thank you.

+ 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. How do I select and copy ranges of indefinite numbers of rows based on sets of criteria?
    By patricia hatton in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-02-2013, 10:11 AM
  2. To select rows based on certain Criteria
    By myths1988 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-30-2013, 11:32 AM
  3. Copy and Paste rows to another spreedsheet based on multiple sets of criteria.
    By juhaszp in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-25-2013, 11:08 AM
  4. select all the rows based on my criteria and should be copied to other workbook ..
    By venkatkumar07 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-07-2012, 09:52 AM
  5. Select rows based on criteria
    By sotiris_s in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-14-2005, 08:40 AM

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