+ Reply to Thread
Results 1 to 7 of 7

Deleting rows based on criteria

  1. #1
    Forum Contributor
    Join Date
    07-16-2008
    Location
    USA
    Posts
    142

    Deleting rows based on criteria

    I'd like to delete all rows where there's a specified value in a specified column. For example:

    -delete all rows where there's an "x" in columnF
    -if cells F15,F17 and F22 have an "x"

    The function will delete rows 15, 17 and 22.

    Thanks!
    Last edited by mcmuney; 06-13-2011 at 06:13 PM.

  2. #2
    Valued Forum Contributor ron2k_1's Avatar
    Join Date
    09-30-2009
    Location
    Not the USA
    MS-Off Ver
    Excel 2003, 2007
    Posts
    606

    Re: Deleting rows based on criteria

    Does column F would have cells that will contain only an "x" or or cells with other text strings that contain "x"? If it is the former, you can use AutoFilter if you're dealing with a table. Filter out as needed and then select the range (from the row indicator), right-click and select Delete.
    Ron
    Knowledge is knowing that a tomato and pepper are fruits. Wisdom is knowing whether to put these in a fruit salad

    Kindly

    [1] Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks
    [2] Mark your post [SOLVED] if it has been answered satisfactorily by editing your original post in advanced mode.
    [3] Thank (using the little scale) those that provided useful help; its nice and its very well appreciated

  3. #3
    Forum Contributor
    Join Date
    07-16-2008
    Location
    USA
    Posts
    142

    Re: Deleting rows based on criteria

    Column F may have other values, but I need to only delete where the value is only "x". Also, I need a macro that will do this. Thanks.

  4. #4
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Deleting rows based on criteria

    Try...

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  5. #5
    Forum Contributor
    Join Date
    07-16-2008
    Location
    USA
    Posts
    142

    Re: Deleting rows based on criteria

    I get a run-time error '1004'.

  6. #6
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Deleting rows based on criteria

    Can you post a small sample workbook?

  7. #7
    Forum Contributor
    Join Date
    07-16-2008
    Location
    USA
    Posts
    142

    Re: Deleting rows based on criteria

    On the attached sample, when the macro is run, rows 8 and 10 should be deleted (because of the "x" on column F).

    Thanks.
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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