+ Reply to Thread
Results 1 to 15 of 15

Macro/VBA code to Filter and delete unwanted data

  1. #1
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Question Macro/VBA code to Filter and delete unwanted data

    Hi,

    Can any please advise me of the macro/vba code require to filter on column ‘C’ for any data that is not ‘Order’ and delete these rows of data and thus only showing rows of data with ‘Order’ in column ‘C’ (Please see attached workbook)

    Any assistance would be greatly appreciated

    Many thanks in advance


    Regards

    Rob
    Attached Files Attached Files
    Rob

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro/VBA code to Filter and delete unwanted data

    Try this:

    Please Login or Register  to view this content.
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro/VBA code to Filter and delete unwanted data

    Hello robertguy,

    Please try this alternative, I am not lazy and have prepared a sample Workbook for your perusal.

    When you click on the "Click" button on Sheet1, it will automatically create a backup of the original Data on Sheet3. That is to have data to fall back onto should you have made a mistake. Inf you did indeed made a mistake the "Reset" button will restore your Data for you, to start over.

    Place the Code below in a Standard Module and enjoy.

    Please Login or Register  to view this content.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro/VBA code to Filter and delete unwanted data

    @ xladept,

    Just an example of how to do something thoroughly

  5. #5
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro/VBA code to Filter and delete unwanted data

    @ Winon - I am grateful for the instruction

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro/VBA code to Filter and delete unwanted data

    @ xladept,

    One day is one day, when I will not only catch up with your niggling sarcasm, but surpass you. Please don't come crying to me then!

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro/VBA code to Filter and delete unwanted data

    @ robertguy - Winon has a point; we could just hide those rows:

    Please Login or Register  to view this content.

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro/VBA code to Filter and delete unwanted data

    @ xladept,

    Hey Orrin,

    I have just noticed that none of your Code returns the Data sample as shown in Sheet2. It remains one row short.

  9. #9
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro/VBA code to Filter and delete unwanted data

    @ Winon - Thanks Tjaart!

    @ robertguy - These get them all:

    Please Login or Register  to view this content.
    Last edited by xladept; 01-25-2018 at 10:59 PM.

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

    Re: Macro/VBA code to Filter and delete unwanted data

    robertguy,

    Try
    Please Login or Register  to view this content.

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro/VBA code to Filter and delete unwanted data

    Hello robertguy,

    As xladept says, if you just want to hide the Rows without "Order" in Column "C" then use his Code as posted above.

    The attached Workbook demonstrates how the Code would work.

    Regards.

  12. #12
    Forum Contributor
    Join Date
    02-09-2004
    Location
    Cardiff - Wales - UK
    MS-Off Ver
    2013
    Posts
    475

    Re: Macro/VBA code to Filter and delete unwanted data

    Winon / jindon / xladept,


    Many thanks for all your prompt replies it is very much appreciated.

    Using a combination of all you excellent responses I have managed to resolved my problem to which I am greatly indebted

    Thanks Again


    Regards


    Rob

  13. #13
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Macro/VBA code to Filter and delete unwanted data

    Hello robertguy,

    Thank you for the feedback.

    You are welcome, glad we could help.

    Also, thank you for the Rep, I really appreciate it!

    Regards.

  14. #14
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: Macro/VBA code to Filter and delete unwanted data

    You're welcome and thanks for the rep!

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

    Re: Macro/VBA code to Filter and delete unwanted data

    Thanks for the rep and glad you like it.

+ 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 Delete Unwanted Worksheets
    By robertguy in forum Excel General
    Replies: 6
    Last Post: 11-29-2017, 07:37 AM
  2. [SOLVED] A Macro to Delete Unwanted Columns
    By newbieexceldude in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-25-2016, 10:36 PM
  3. Macro to filter on unwanted data and delete
    By robertguy in forum Excel General
    Replies: 1
    Last Post: 12-07-2016, 02:31 PM
  4. [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
  5. Replies: 0
    Last Post: 08-02-2012, 10:46 PM
  6. Macro to delete unwanted data
    By rizmomin in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-22-2007, 04:05 AM
  7. [SOLVED] I need a macro to delete unwanted data
    By Jason in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-25-2005, 07:06 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