+ Reply to Thread
Results 1 to 6 of 6

Copy data from one sheet too different new sheets based on a filter

  1. #1
    Registered User
    Join Date
    03-12-2019
    Location
    Hasselt
    MS-Off Ver
    Office 2013
    Posts
    10

    Copy data from one sheet too different new sheets based on a filter

    Hello,

    I have a base datasheet and I would like to extract from this datasheet with a button, data which is filtered. These filters are fixed, so nobody have to select what should be filtered. With one push of the button the new files shoud be generated.

    I have added an example file. Within this file I would like to have 3 new files based on the value in column 3 "LOCATIE". At the moment you can find the following data in this file: E01 /E01-MP1 / E01-MP2.

    So I would like to have 3 files named E01 / E01-MP1 and E01-MP2.

    The second filter would be the data which is the column 2 "DRAAD_ID". If this cell is "empty" or "xxxx", this row should not be exported.

    Can some body help me with this?

    Best Regards
    Attached Files Attached Files

  2. #2
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Copy data from one sheet too different new sheets based on a filter

    Maybe something like this? I'm sure it could be written better but this should be simple enough to follow and adapt where necessary.

    It will save the three 'filtered' workbooks to the same folder the main workbook is in.

    Please Login or Register  to view this content.
    BSB

  3. #3
    Registered User
    Join Date
    03-12-2019
    Location
    Hasselt
    MS-Off Ver
    Office 2013
    Posts
    10

    Re: Copy data from one sheet too different new sheets based on a filter

    That is nice to start from. Thanks for that.

    I Have one more question. I would like to paste the cells but only the values.

    With the .Sheets(1).paste the formulas stay in the new sheet and that is not ok.

    So how can I adapt this paste function?

    Regards

  4. #4
    Registered User
    Join Date
    03-12-2019
    Location
    Hasselt
    MS-Off Ver
    Office 2013
    Posts
    10

    Re: Copy data from one sheet too different new sheets based on a filter

    Hello,

    I have changed the coded that was proved by BSB. But now I have on other problem. I would like to copy the format of the range and only the values which are in the cells. I don't need the formulas any more.

    I have attached a copy. On the second sheet, at the bottom, you can find the button to activate the code to copy and create the new documents.

    If I want to copy the format of the selected range. The format is copied to a range bigger than the range that was selected. So how can I copy the values and the formats of the selected range.

    Regards
    Attached Files Attached Files

  5. #5
    Forum Expert BadlySpelledBuoy's Avatar
    Join Date
    06-14-2013
    Location
    East Sussex, UK
    MS-Off Ver
    365
    Posts
    7,468

    Re: Copy data from one sheet too different new sheets based on a filter

    Paste the whole lot in, formulas and all then use the below to convert it all to values rather than formulas.
    Please Login or Register  to view this content.
    BSB

  6. #6
    Registered User
    Join Date
    03-12-2019
    Location
    Hasselt
    MS-Off Ver
    Office 2013
    Posts
    10

    Re: Copy data from one sheet too different new sheets based on a filter

    BSB,

    Thanks for the reply, with that piece of code it does what I wnat it to do.

    Just another question. I the first part of code you gave me, you have 4 fixed filter. Now I would like to check each range before it is copied. If the range is empty, I don't want it to be copied.

    How do I check if a range is empty after we set the autofilter?

    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. Excel - macro/filter to copy data from one sheet to another based on date
    By liqt in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-19-2018, 06:46 PM
  2. Replies: 2
    Last Post: 06-29-2016, 03:56 PM
  3. Excel VBA - Copy Data based on a cell value and filter to new sheet
    By scruz9 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-18-2016, 08:06 AM
  4. filter data based on criteria and copy to another sheet
    By anbarasi_r in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-23-2015, 09:56 PM
  5. Filter copy paste data based on sheet name
    By kannan1847 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-31-2015, 01:58 PM
  6. Copy fitered data from 1 wb to multiple sheets of another wb based on the filter
    By alfaia in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-22-2014, 09:31 AM
  7. [SOLVED] Copy data to different sheet based on filter and add total rows
    By ravibemail in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-09-2012, 07:25 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