+ Reply to Thread
Results 1 to 16 of 16

Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a field

  1. #1
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Post Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a field

    Hi,

    I have gone through many posts and could not make it on own on the below for what i am looking for.
    looking for help in the below...

    Having three sheets in a workbook,
    > Filter Emp IDs in each sheet - Emp IDs in each sheet will be in different column
    > Copy visible data of all sheets to a new workbook - sheets should be same from the working file to new workbook
    > Save the file with the EMP ID from the First sheet
    > iterate the above for all the emp ids in the first sheet.

    Appreciate on your help...

    My apologies for not able to attach file and would request if some one can help me with the attaching file.

    Also, posted in the below forum
    https://www.mrexcel.com/board/thread...-name.1164852/
    http://www.vbaexpress.com/forum/show...ht=#post408000
    Last edited by davesexcel; 03-14-2021 at 02:59 PM.
    Thanks & Regards
    Chaitanya A

  2. #2
    Forum Expert Kenneth Hobson's Avatar
    Join Date
    02-05-2007
    Location
    Tecumseh, OK
    MS-Off Ver
    Office 365, Win10Home
    Posts
    2,573

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Put macro in Module of a backup of main file and run.
    Please Login or Register  to view this content.
    Last edited by Kenneth Hobson; 03-14-2021 at 04:28 PM.

  3. #3
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Hi Kenneth,
    Thanks a ton for the code and help.
    As guided, i have put the code in a module and ran. However, it thrown me an error at line

    Please Login or Register  to view this content.
    vba run-time error 2146232576 (80131700)

    Any help on this please... do i need to enable any references from Tools.

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    anchuri_chaitanya,
    Try the attached.
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Hi Kenneth,

    Searched the error code and find that .NET wireframe to update. after download and installing .NET wireframe the below error is gone and the code is just worked fine.

    vba run-time error 2146232576 (80131700)

    https://www.microsoft.com/en-in/down...lforq1r6k1yg00

    Thank you so much for the code!

  6. #6
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Hi Jindon,

    Your code too worked perfect and thanks for the needful.

  7. #7
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Hi,

    My apologies for another ask in this filtering out and creating individual sheets.

    Is it possible to have multiple filter in the sheets based on the selections in from another sheet and generate the individual files.

    Here, instead of only Emp ID now have to filter on other columns/fields as well. These filters will be same in all the three sheets but different columns numbers.

    Attaching here with the excel file and First sheet i have mentioned the need.

    Would request for help.

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Hi Jindon,

    Code working fine without any issues. Generating all EMP files.

    My need of generating files individually based on the filters in the sheet4 and save the files with EMP ID+MonthName+Department.
    Attached here with few files and as per the selection in filters is only Department as IT.
    For IT department - all Months - Emp ID ALL -
    1. Files to generate as - in the summary sheet data only IT department records to filter - for all months (as monthwise is selected as ALL in sheet4) - files to generate for each EMP in IT department.
    2. likewise, if selected 3/15/2021 in month wise - and - ALL in department - then - filter 3/15/2021 records in summary sheet - department filter will not take any value as the value for department in sheet4 is ALL and generate files for each EMP
    3. similarly, the combination of the three fields in sheet4.
    Am sorry if the above is not clear and would request you to let me know in case of anywhere that i am not clear.
    Thank you.
    Attached Files Attached Files

  10. #10
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    No idea why you have 2 records in Summary sheet for 11111.
    Are you talking about different data set?

  11. #11
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Hi Jindon,

    That is because of more than one month - this is due to the selections as below in Sheet4 for
    Monthwise = ALL
    Department wise = IT
    EMP ID = ALL
    as per the above selections in sheet4, having two employees for IT department and for all months - 11111 has two records for all months in summary sheet column E and similarly for 55555.

    If the above is confused and is it possible as per the below scenario to generate files...
    Monthwise = ALL
    Departmentwise = ALL
    EMP ID = ALL

    then for each month and department wise emp id in the filtered to generate files
    EX:
    there are two values in the month column = so two times filter
    month column filter followed by department column having 4 values = four times filter
    and for each employee filter - generate files

    if the sheet4 values selected instead of ALL as below then only to generate the selected values related file
    Monthwise = 3/15/2021
    Departmentwise = IT
    EMP ID = 11111 - generates only 11111 related file for the month record 3/15/2021 and department is IT
    or EMP ID = ALL - then all the emp id files related to monthwise 3/15/2021 and department IT will only to generate.

    Extremely sorry for the confusion you had with my queries as i am not that good at writing. Please consider.

  12. #12
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    When you ask question, the data and workbook should be consistent, otherwise confusing people.
    Change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  13. #13
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    Hi Jindon,

    Thank you so much and yes, will be careful while posting.

  14. #14
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    change in the requirement and as per my knowledge along with the help of search over internet,
    worked on creating a list and unique values for drop down lists in master sheet

    and this one last ask for help me in this requirement.

    Based on the selection in the dropdown list - values within the drop down should iterate and filter the Summary, Order, Prod sheets
    generate xl files and save file name with "EMPID_Department_Month"

    1 If Selected "ALL" in any of the C5, C6, C7 then
    2 Filter the Summary, Order, Prod sheets with all the values(iterate drop down list)
    with in the drop down from C5, C6, C7 (excluding "ALL" from the drop down)
    3 Else,
    4 based on the values selected in the dropdown list in C5, C6, C7
    5 filter the summary, order, prod sheets with the drop down values
    6 Generate Individual files with the Summary, Order, Prod sheets
    7 Save the generated file with the value of C7_C6_C5
    8 Ex:
    22222_Ops_ALL

    Attached file.

    Thank you.

  15. #15
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie



    Any support please...

  16. #16
    Forum Contributor
    Join Date
    06-04-2011
    Location
    Hyderabad
    MS-Off Ver
    Excel 2007
    Posts
    108

    Re: Autofilter in Multiple sheets - copy sheets to new workbook - save workbook with a fie

    i have posted as a separate thread for looping through data validation filters and filtering multiple sheets to generate individual files and would request for any help please.
    http://www.vbaexpress.com/forum/show...files&p=408131

    i am closing this thread with solved as Kenneth and Jindon had helped out for the initial requirement i posted.

    Thank you so much for the needful in helping out on the initial ask.

    Any guidance on iterating dropdown values to filter multiple sheets will help.

+ 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. Copy info from multiple sheets and open/save to new workbook
    By Halid in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-02-2020, 06:53 AM
  2. Replies: 0
    Last Post: 07-01-2015, 03:33 PM
  3. copy sheets and save as new workbook
    By albert28 in forum Excel General
    Replies: 4
    Last Post: 03-25-2014, 01:31 AM
  4. [SOLVED] Macro to copy cells from multiple sheets in workbook to multiple sheets in other workbook
    By KeithMale in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-13-2013, 05:37 PM
  5. Copy rows from multiple sheets in one workbook into a different workbook
    By maneeshagr in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2012, 06:24 AM
  6. Copy 5 sheets to new workbook with dialog form where to save
    By Josh_123456 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-24-2008, 09:11 AM
  7. Copy specific Sheets and save them as a workbook
    By Rock* in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-13-2006, 04:35 PM

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