+ Reply to Thread
Results 1 to 10 of 10

Delete rows using filters

  1. #1
    Registered User
    Join Date
    07-25-2017
    Location
    Latvia
    MS-Off Ver
    MS Office 2010
    Posts
    91

    Delete rows using filters

    Hi!

    I have a table. I need to write macro, so that all rows with specific values in Column4 are deleted (say ''Africa'' and ''Europe'' in this example).
    Unfortunately seems like my code is wrong. On one computer it deleted top row on another one it only deleted rows with one of these values.
    Please help me with this code or propose easier and better one.

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

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,890

    Re: Delete rows using filters

    I like this method:

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Delete rows using filters

    See next Code
    Please Login or Register  to view this content.
    - Battle without fear gives no glory - Just try

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow Hi !


    Quote Originally Posted by robert26 View Post
    Delete rows using filters
    I hope you do not have too much rows as it's not a fast way …

  5. #5
    Registered User
    Join Date
    07-25-2017
    Location
    Latvia
    MS-Off Ver
    MS Office 2010
    Posts
    91

    Re: Delete rows using filters

    Quote Originally Posted by alansidman View Post
    I like this method:

    Please Login or Register  to view this content.
    thank you for idea. however this would be used for a very large database and I think these messageboxes wont be the best option.

  6. #6
    Registered User
    Join Date
    07-25-2017
    Location
    Latvia
    MS-Off Ver
    MS Office 2010
    Posts
    91

    Re: Delete rows using filters

    I like it. However, if I perform it 2nd time (might be missclick or sth) it deletes all other data.

  7. #7
    Registered User
    Join Date
    07-25-2017
    Location
    Latvia
    MS-Off Ver
    MS Office 2010
    Posts
    91

    Re: Hi !

    few thousand rows. To be honest, I do not care how i get rid of these rows. Just looking it to be one click away

  8. #8
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,066

    Re: Delete rows using filters

    A remake without using the activesheet,, so more flexible
    Please Login or Register  to view this content.

  9. #9
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: Delete rows using filters

    However, if I perform it 2nd time (might be missclick or sth) it deletes all other data.
    Modify PCI's code to something like below.
    Please Login or Register  to view this content.
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  10. #10
    Registered User
    Join Date
    07-25-2017
    Location
    Latvia
    MS-Off Ver
    MS Office 2010
    Posts
    91

    Re: Delete rows using filters

    yup, works perfectly. thanks to everyone!

+ 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] Delete visible filters
    By fantasylo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-08-2019, 01:12 PM
  2. Rows delete formula as per range of cell values with counter to delete # rows
    By qureshi2016 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-03-2017, 09:35 AM
  3. 2 Filters at different Rows in one table
    By Cessh in forum Excel General
    Replies: 8
    Last Post: 09-11-2017, 01:16 PM
  4. [SOLVED] Use of Three filters and Delete Rows using VBA Code in Excel
    By gbloemke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-01-2013, 03:27 PM
  5. Replies: 3
    Last Post: 08-22-2012, 03:57 PM
  6. [SOLVED] Sorting Filters for Zeros And delete The rows containing zeros
    By theprincesunil in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-25-2012, 06:10 AM
  7. Filters To Delete Stuff?
    By zudecke in forum Excel General
    Replies: 9
    Last Post: 06-25-2010, 03:28 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