+ Reply to Thread
Results 1 to 7 of 7

Macro to filter data and copy to another workbook

  1. #1
    Registered User
    Join Date
    12-15-2010
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Macro to filter data and copy to another workbook

    Hi Guys,
    I am trying to write a macro that will filter the data out of one workbook and paste it in another based on the criteria provided for in column A and C. The criteria for A is fixed say
    "1" but the criteria for column C is going to be an array for 200 different items.

    Also i want the macro to look through all the worksheets of a workbook as i have three worksheets with 65536 line items. and copy data to new workbook.

    I have attached a dummy data sheet for reference.
    So, my criteria for coulm A is "1" and array of criteria for colimn C is (" AA, BB, , DD, FF, GG, HH, JJ").

    I want to macro to set Column A on "1" and then cycle through the criteria on Column C copy and pasting the data in to new work book, it will reset the filters each iteration. If there is error like it cant find any criteria in column C show message and continue to next criteria .

    Any help will be highly apprecited.

    Thanks.
    Roop
    Attached Files Attached Files
    Last edited by Roop; 05-18-2011 at 08:29 PM.

  2. #2
    Registered User
    Join Date
    12-15-2010
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Macro to filter data and copy to another workbook

    I just thought may be i don't need to cycle through the criteria on Column C, it will be great if it selects all the concerned choices and then copies all the data to new woorkbook.

  3. #3
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Macro to filter data and copy to another workbook

    Hi,

    Maybe something like this will work for you,

    I placed a button on sheet(1) to run the script.
    It will filter each sheet by the number that is placed in the input box.
    it will save to you C: Drive by default you can change the path to soot your needs.
    The file name will be either
    Results 1
    Results 2
    Results 3
    Depending on the choices made.
    After the first choice it will ask you if you want to continue and loop till all choices (ect 1,2,3) are complete.

    Let me know of any issues or changes required.
    Attached Files Attached Files
    Last edited by realniceguy5000; 05-10-2011 at 04:37 PM. Reason: Edit File
    Thank You, Mike

    Some Helpful Hints:

    1. New members please read & follow the Forum Rules
    2. Use Code Tags...Place[code]Before the first line and[/code] After the last line.
    3. If you are pleased with a solution mark your post SOLVED.
    4. Thank those who have help you by clicking the scales at the top right of the post.

    Here...

  4. #4
    Registered User
    Join Date
    12-15-2010
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Macro to filter data and copy to another workbook

    Hi Mike,
    This looks too complicated for me, I just want a macro which filters column A on option "1" . then filters Column C for ("AA","BB","CC", "DD","FF","GG", "HH", "JJ"), Copy all that data to another workbook.

    Now the real problem is that my data is scattered over three worksheet as i was not able to fit on one. I want macro to look through all three sheets, i dont know if i can do that. May be i have to start at sheet1 pull out what i find there, then go sheet2 pull put what i find on that andso on. My list of criteria for column C is 200 items long and they might not all be on the same sheet. I don't really know how many criterion i can give in a macro.

    I really appreciate your help

    Roop.

  5. #5
    Registered User
    Join Date
    12-15-2010
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Macro to filter data and copy to another workbook

    Hi Guys ,
    So, i got this Macro that filetr data in sheet1 according to criteria given on sheet2 and copies the information to sheet3. Now my original data is apnned over Sheet1, Sheet2 and Sheet3 ( all 65536 rows), Is there a way to change this macro to go through all three sheets an copy the matching data to new workbook , because unlike the Dummy data sheet attached the macro will not find all the information matching requested criteria on one sheet.

    Any help will be highly appreciated

    Thanks.

    Roop

    Please Login or Register  to view this content.
    Attached Files Attached Files

  6. #6
    Valued Forum Contributor realniceguy5000's Avatar
    Join Date
    03-20-2008
    Location
    Fl
    MS-Off Ver
    Excel 2003 & 2010
    Posts
    951

    Re: Macro to filter data and copy to another workbook

    Give This A Try,

    This Will Filter by col A BY 1
    This Will Filter by col C BY ("AA","BB","CC", "DD","FF","GG", "HH", "JJ")
    This Will Add a New Workbook for each Filter In C
    This Will Also Give you an option to put all the filtered workbooks back together into one with each sheet in that workbook being the filter list from C or you can just leave them in seperate workbooks by clicking no.

    Let me know,
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    12-15-2010
    Location
    Oregon, USA
    MS-Off Ver
    Excel 2007
    Posts
    48

    Re: Macro to filter data and copy to another workbook

    Thanks a lot mike.

+ 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