+ Reply to Thread
Results 1 to 6 of 6

Copy multiple rows from different sheets given two conditions to a new workbook

  1. #1
    Registered User
    Join Date
    08-13-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Copy multiple rows from different sheets given two conditions to a new workbook

    I have attached my sample file here. I'm trying to copy the rows that meets the condition of date = today and the details = ok.

    The complete row that meets that condition will be copied to a new workbook. (Either new or an existing workbook will do)

    The macro will check all the sheets that meets the condition and copy them to a workbook with the same format and the same number of sheets.

    Is this possible???

    Please advise

    Thanks
    Attached Files Attached Files

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

    Re: Copy multiple rows from different sheets given two conditions to a new workbook

    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]

  3. #3
    Registered User
    Join Date
    08-13-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Copy multiple rows from different sheets given two conditions to a new workbook

    Thank you for this Ma'am I'll give it a try and send you a feedback later. Thanks

    Edit:
    It works like a charm Ma'am.

    Thank you so much,

    By the way, if I want to delete the copied rows, what should I add to the codes?

    is this the correct code???

    Please Login or Register  to view this content.
    Last edited by testingandroid; 08-28-2012 at 09:03 PM.

  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: Copy multiple rows from different sheets given two conditions to a new workbook

    If you need to delete the rows, you need to start from the last row of the sheet upwards to avoid any endless loops.

    I have revised your code as follows -
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    08-13-2012
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    7

    Re: Copy multiple rows from different sheets given two conditions to a new workbook

    Again ma'am thank you so much, I'll use this codes and also study them.

    Thank you for this solution. I'll mark this thread resolved now.

    Keep up the good work ma'am.

    Thanks,

    Brian

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

    Re: Copy multiple rows from different sheets given two conditions to a new workbook

    Am glad it worked for you.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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