+ Reply to Thread
Results 1 to 22 of 22

Auto filter delete after copied

  1. #1
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Question Auto filter delete after copied

    Hi,

    My code below filters data in one tab then takes the top 10 values and copy and paste them into a three new tabs. The code works but how do I delete the rows from the original tab after they have been copied to the new tabs?

    Please Login or Register  to view this content.
    h

  2. #2
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    For example, filter for the first one (Array (10, "New Dead")). Paste the top values into the new tab. Then delete the top 10 values data from the tab it was filtered in. Then move on to the next one (Array(12, "New Excess"))

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

    Re: Auto filter delete after copied

    Untested
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    I keep getting an "Application defined or object defined" error

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

    Re: Auto filter delete after copied

    Then need to see you workbook with before/after.

  6. #6
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    I attached an example workbook.

    The full tab has all the data then the data gets filtered onto the "New" tabs. In the tab "New Excess" and "New slow" you can see I highlighted a couple rows in red.

    The "New Excess" tab should have the top ten values for the excess qty and "New slow" should have the top 10 for the slow qty.

    But right now some rows are showing up on both tabs because they are in the top 10 for both, (the red ones). I don't want this to happen I want it to only show up once.

    So I am trying to have the row be deleted after it is filtered so it will only show up in one of the tabs.
    Attached Files Attached Files

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

    Re: Auto filter delete after copied

    Why do all new sheets have 2nd row blank?

  8. #8
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89
    Quote Originally Posted by jindon View Post
    Why do all new sheets have 2nd row blank?
    That is a bug in the code I haven’t been able to figure out yet. They shouldn’t be blank.

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

    Re: Auto filter delete after copied

    OK, you said some names are in the both new sheets in your workbook colored red.

    What do you want to do with these?
    Appear to a specific new sheet only?
    If so, what is the logic?

    They are Top 10 for different column, so it could happen...

  10. #10
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    Sorry I forgot to include that - I would like them to occur in the top ten dead first, then top ten excess, then top ten slow.

    So if they are in both excess and slow I would like it to show in excess.

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

    Re: Auto filter delete after copied

    Top 10 for each name for each column that have greater than 0.
    Results are slightly different from yours, so check.
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    It works like a charm!!!! Thank you!!!

    I keep trying to add a filter in so it only pulls data that has column 18 blank. I had an auto filter for it in my old code but every way I try to add it in here I keep breaking it :/

    The filter in my old code:
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    Also, I added more people in the below and it isn't doing it for all of them. It will only do it for the first name then lump all the other names together.

    Thank you for all the help on this, I really appreciate it!

    Please Login or Register  to view this content.

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

    Re: Auto filter delete after copied

    1) Why?
    Please Login or Register  to view this content.
    Col.18 = Col.R and have no heading/data at all.

    2) Do you want to do the same for all the unique name in Col.D, or only the names that have worksheet?

  15. #15
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    1. It is a column in the report that they will be adding - it will be a column or dates. So yes there will also be a header there called "Date"

    2. All unique names. So exactly what that code does with those two names but for more. So there will be in total 10 names.

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

    Re: Auto filter delete after copied

    Try
    Please Login or Register  to view this content.

  17. #17
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    Wow!!! Works Like a charm with all the names!! My old code ran so much slower... so thank you!!!

    The only thing I noticed is the data with a date in column 18 is still getting pulled in. Is there a way so any data that has a date in column 18 won't be included?

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

    Re: Auto filter delete after copied

    Just change
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    Then it will still pull in the rows with data in column 18. It just won't pull in column 18 but the rest of the row (1-17) will still be there.

    I am looking for it to exclude any rows with data in column 18 from being filtered.

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

    Re: Auto filter delete after copied

    It would help to understand what you are trying to do if you upload your workbook and result that you want.

  21. #21
    Registered User
    Join Date
    06-28-2018
    Location
    US
    MS-Off Ver
    2016
    Posts
    89

    Re: Auto filter delete after copied

    I attached a new workbook. As you can see the first tab has data in red that has a date in column 18. That data then is not filtered in to any of the three "New" tabs.
    Attached Files Attached Files

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

    Re: Auto filter delete after copied

    If you want to exclude the rows that have data in Col.R then add lines in bold.
    Please Login or Register  to view this content.

+ 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] Auto filter with copied data
    By scabertrain in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2014, 06:41 PM
  2. Delete Rows hidden by either Auto Filter and Advanced Filter
    By lesoies in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-05-2013, 10:29 AM
  3. [SOLVED] Auto filter and delete unwanted rows - Micro help
    By turbo600hp in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-26-2012, 05:19 PM
  4. [SOLVED] Auto Filter Top Line copied to A400
    By BigTandthepc in forum Excel General
    Replies: 3
    Last Post: 06-27-2012, 10:50 AM
  5. Delete a Row from auto filter view in excel 2007
    By ramu2k06 in forum Excel General
    Replies: 3
    Last Post: 05-18-2010, 07:08 AM
  6. Delete with auto filter
    By martinez_pedro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2009, 06:00 PM
  7. Delete row and auto filter
    By RMJames in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2006, 11:10 AM
  8. Replies: 1
    Last Post: 07-04-2005, 09:05 AM

Tags for this Thread

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