+ Reply to Thread
Results 1 to 5 of 5

delete rows based on a criteria

Hybrid View

Ralem delete rows based on a... 05-12-2011, 02:45 AM
arthurbr Re: delete rows based on a... 05-12-2011, 02:49 AM
Alf Re: delete rows based on a... 05-12-2011, 03:24 AM
Ralem Re: delete rows based on a... 05-12-2011, 05:34 AM
Alf Re: delete rows based on a... 05-12-2011, 06:47 AM
  1. #1
    Registered User
    Join Date
    04-10-2010
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2003, 2007 and 2010
    Posts
    148

    delete rows based on a criteria

    All,

    Appreciate providing me with a code to delete rows in my sheet based on the values in column C :

    If values in column C are from 40 to 50 then delete the rows containing these values.

    Thanks
    Cheers
    Ralem

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: delete rows based on a criteria

    Hi

    try using Data - Filter Autofilter - in col C select "Custom" from the drop down box
    as conditions use "is larger or equal to 40"
    check " and"
    second condition "is smaller or equal to 50)
    Activate filter

    delete the rows and remove the filter

  3. #3
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: delete rows based on a criteria

    Or if you prefere a macro code:

    Option Explicit
    
    Sub Delete_Row()
    
    Dim i As Integer
    
    For i = Range("C" & Rows.Count).End(xlUp).Row To 1 Step -1
    
    If Cells(i, 3).Value >= 40 And Cells(i, 3).Value <= 50 Then
     Rows(i).Delete
    End If
    Next i
    
    End Sub
    Alf

  4. #4
    Registered User
    Join Date
    04-10-2010
    Location
    Abu Dhabi, UAE
    MS-Off Ver
    Excel 2003, 2007 and 2010
    Posts
    148

    Re: delete rows based on a criteria

    Yes Alf, I am looking for a macro code to do this.

    Thank you very much

  5. #5
    Forum Expert Alf's Avatar
    Join Date
    03-13-2004
    Location
    Gothenburg/Mullsjoe, Sweden
    MS-Off Ver
    Excel 2019 and not sure I like it
    Posts
    4,784

    Re: delete rows based on a criteria

    Glad to be of help.

    Alf

+ 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