+ Reply to Thread
Results 1 to 5 of 5

Unable to delete certain rows

  1. #1
    Registered User
    Join Date
    04-15-2016
    Location
    Ronneby, Sweden
    MS-Off Ver
    2013
    Posts
    2

    Unable to delete certain rows

    Hallo helpers

    I'm unable to find a solution using VBA.
    I need to delete entire rows where a cell in that row has a certain value.

    AAA BBB CCC
    1 2 3
    11 22 33
    111 2 333
    111 222 333

    I need to remove the rows that have value 2 in column BBB (In this case row 1 and 4)
    I need the result to be:

    AAA BBB CCC
    11 22 33
    111 222 333

    Hope for your help
    Thank you

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,996

    Re: Unable to delete certain rows

    Why do you need VBA? You could just Autofilter column B for the value 2 and delete visible data rows. If you need a macro, record the filtering and deleting.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2507 Win 11
    Posts
    24,919

    Re: Unable to delete certain rows

    Try this:

    Option Explicit

    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

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,080

    Re: Unable to delete certain rows

    Another approach:
    Please Login or Register  to view this content.
    I assumed you were using columns A, B and C.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  5. #5
    Forum Contributor
    Join Date
    01-18-2013
    Location
    Prague
    MS-Off Ver
    Excel 2013
    Posts
    161

    Re: Unable to delete certain rows

    When running the code, a input box will appear in which you'll need to enter the column you like to choose.
    The code below will delete the rows containing number 2 in the column that you'll choose.

    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. Unable to insert or delete rows
    By AvrilA in forum Excel General
    Replies: 3
    Last Post: 04-12-2016, 02:53 AM
  2. Unable to delete rows
    By Kingsta in forum Excel General
    Replies: 1
    Last Post: 06-01-2014, 05:49 AM
  3. Replies: 3
    Last Post: 11-08-2012, 07:25 PM
  4. [SOLVED] Unable to delete rows
    By Mrowe in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-19-2012, 03:08 PM
  5. Excel 2007 : Unable to delete a macro
    By Martin Chamberlin in forum Excel General
    Replies: 1
    Last Post: 05-25-2012, 04:18 PM
  6. Unable to delete worksheet
    By hazrd in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-12-2007, 10:42 PM
  7. Unable to delete rows or columns? Why?
    By Barney Quinn in forum Excel General
    Replies: 3
    Last Post: 09-17-2006, 09:43 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