+ Reply to Thread
Results 1 to 8 of 8

Macro to filter by two columns and save file

  1. #1
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Macro to filter by two columns and save file

    Dear Jindon,

    There is a solution you provided in the link below that i would love to adapt and adopt for my own use.

    http://www.excelforum.com/excel-prog...save-file.html

    My twist:

    I have a database that should be splitted into new workbooks by using the "Report Name one and two" as the basis of separating the data. The twists are:

    TestData.xlsx
    1. If a name appears in both under "Report name one and two" then the data should be extracted together else the "Report name one" should suffice. e.g. WS appears both in the Report name one and two, i would prefer the are extracted together into just one workbook.
    2. I only want to extract selected headers from the "Data" Sheet rather than everything. See the "Desired Output" sheet for the headers of interest.

    I dont know if i am asking for too much..However, any help will be much appreciated.

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

    Re: Macro to filter by two columns and save file

    Your explanation and the result are not clear to me.

    Do you want to create only one workbook based on "Data" sheet?

    If not, I need to see more result for each new workbook.
    If true, why those 3 rows?

  3. #3
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Macro to filter by two columns and save file

    Here are some of the some the data extracted to new workbooks.

    WS.xlsx
    MT.xlsx

  4. #4
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Macro to filter by two columns and save file

    The deal is to extract data based on column E and saved as a new workbook.. However, there are some Items in Column F that should be extracted along with the data in column E.

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

    Re: Macro to filter by two columns and save file

    See if this is how you wanted.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Macro to filter by two columns and save file

    Fantastic Jidon! it worked beautifully well (Really need to come and learn).. Just wondering if i can play around with the headers..

    For example: if i decided to use another set of headers that are different from the initial one included in my earlier sample workbooks, will this code still handle? or can you help tweak this code so that the headers can be read from a range somewhere in the workbook. This would give me the flexibility to add or remove headers or any of the columns without wading through the code to modify.

    I have included another sheet showing the report headers in the "Mapping" Sheet.

    TestData_1.xlsx

    Many thanks again for your time!

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

    Re: Macro to filter by two columns and save file

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    06-08-2012
    Location
    Lagos, Nigeria
    MS-Off Ver
    Excel 2007, 2010, 2016
    Posts
    102

    Re: Macro to filter by two columns and save file

    yiiippppiiiee! It worked as designed... To think i have been thinking about how to go about this for days..

    I am truly grateful Jindon! Many thanks once again for taking time to help out with this!

    Regards!

+ 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] Macro to filter by column and save file
    By Sgligori in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-09-2015, 11:25 AM
  2. Replies: 1
    Last Post: 09-05-2013, 02:39 PM
  3. [SOLVED] Need a Macro to group certain columns and save them as a separate file in specific folder
    By acsishere in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-31-2013, 11:51 AM
  4. Macro to Arrange the columns and save to csv file
    By virtualboy1972 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-27-2012, 03:33 PM
  5. How To keep Columns when Using a Macro to automatically save a .csv file
    By JonTtrier in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-31-2012, 10:24 PM
  6. macro required to filter data on several tabs and save to a file, then repeating action
    By Stevengreen22 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-04-2012, 10:26 AM
  7. How to set file Filter in Save dialog box
    By sreenath205 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-31-2006, 08:53 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