+ Reply to Thread
Results 1 to 12 of 12

Need help deleting filtered data only within a range in vba

  1. #1
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    Need help deleting filtered data only within a range in vba

    Greetings,

    I was hoping someone could suggest some vba coding which would delete filtered data only excluding the header row, which would have a range of Column A through AI. I have data in cells past AI that I wouldn't want deleted and thus any cells deleted would have to bring the cells below them (not filtered) up after the filtered data is deleted. Hope that makes sense.

    I've attached a small sample workbook, which also gives a little explanation of what I'm trying to accomplish as an example.

    Thanks for any suggestions in this request!
    Attached Files Attached Files
    Last edited by lilsnoop; 03-29-2020 at 03:10 PM.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Need help deleting filtered data only within a range in vba

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 03-29-2020 at 02:40 PM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Need help deleting filtered data only within a range in vba

    I think that with filtered ranges you can only delete the entire row, how about this instead
    Please Login or Register  to view this content.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,232

    Re: Need help deleting filtered data only within a range in vba

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    Re: Need help deleting filtered data only within a range in vba

    Hello AlphaFrog Thank you for tackling this problem. Your code works perfect deleting the filtered data, but it is also deleting data beyond the AI column for that same deleted row of filtered data.

  6. #6
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    Re: Need help deleting filtered data only within a range in vba

    Fluff13 - Thank you! That code does exactly what I need!
    Really appreciate everyone's assistance!

    Carl

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,232

    Re: Need help deleting filtered data only within a range in vba

    Just out of curiosity...I am assuming you made use of the provided code with your actual code...
    Does post 4 not justify a response...

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Need help deleting filtered data only within a range in vba

    You're welcome & thanks for the feedback

  9. #9
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,232

    Re: Need help deleting filtered data only within a range in vba

    @ Fluff13
    I think that with filtered ranges you can only delete the entire row
    Just in case you missed it...Post 4 allows for this...

  10. #10
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Need help deleting filtered data only within a range in vba

    Agreed & didn't think of doing it like that, but in this instance it also destroys some of the formulae in col AJ

  11. #11
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,232

    Re: Need help deleting filtered data only within a range in vba

    True...however the range just needs to be extended to include AJ...OP just needed to explain his required output in more detail...

  12. #12
    Valued Forum Contributor
    Join Date
    03-17-2007
    Location
    Michigan
    MS-Off Ver
    Excel 2016
    Posts
    957

    Re: Need help deleting filtered data only within a range in vba

    Sintek,

    Your coding worked well too! Thank you for taking the time to help, it was much appreciated!

+ 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 filtered data into filtered range in a separate sheet
    By vikas.trades25 in forum Excel General
    Replies: 1
    Last Post: 02-07-2019, 04:04 AM
  2. Replies: 3
    Last Post: 05-07-2017, 02:53 PM
  3. Replies: 9
    Last Post: 08-14-2013, 12:10 AM
  4. [SOLVED] VBA code for deleting Rows that contain specific criteria from Filtered Data
    By carlosriver24 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-31-2012, 12:23 PM
  5. Need help deleting filtered data
    By narrowgate88 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-01-2012, 03:44 PM
  6. Deleting filtered out data from a worksheet
    By Sierras in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-20-2006, 05:30 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