+ Reply to Thread
Results 1 to 3 of 3

Delete multiple rows of data based on criteria in a single cell

Hybrid View

slaga9 Delete multiple rows of data... 03-11-2011, 03:58 PM
HSV Re: Delete multiple rows of... 03-11-2011, 04:24 PM
royUK Re: Delete multiple rows of... 03-12-2011, 03:41 AM
  1. #1
    Registered User
    Join Date
    03-10-2011
    Location
    Ontario, canada
    MS-Off Ver
    office 2007
    Posts
    3

    Delete multiple rows of data based on criteria in a single cell

    I need to filter through the name and address of a client list- deleting entires that have a DO NOT CALL listed in C coloum.

    I cant attach the file as I have client information in it, but in short I have 3 coloums, with multiple rows

    each entry has a name, a phone number, an address, a city, and if they are "OK" or "Do Not Call"

    Is set up as such

    A -----------------------------B-----------------------------------------C

    Name
    #------------------------------#---------------------------------"Do Not Call"
    Address
    City


    Name
    #------------------------------#---------------------------------"OK"
    Address
    City

    Name
    #------------------------------#---------------------------------"Do Not Call"
    Address
    City


    What I need to do is delete the entry if they have "Do not call" in C

    meaning, i need to delet the entire row directly above it, the row that has (do not call) and the 2 below it.

    Is this possible?


    Thanks

  2. #2
    Valued Forum Contributor
    Join Date
    02-12-2011
    Location
    The Netherlands
    MS-Off Ver
    365
    Posts
    860

    Re: Delete multiple rows of data based on criteria in a single cell

    Try this code once a testfile.


    Sub tst()
       Dim i As Integer, cl As Variant
        For i = Cells(Rows.Count, 3).End(xlUp).Row To 1 Step -1
          For Each cl In Range(Cells(2, 3), Cells(Cells(Rows.Count, 3).End(xlUp).Row, 3))
        If cl = "do not call" Then
            cl.Offset(-1).Resize(4).EntireRow.Delete
         End If
        Next cl
      Next i
    End Sub
    Last edited by HSV; 03-11-2011 at 04:27 PM.
    Harry.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Delete multiple rows of data based on criteria in a single cell

    Don't start new threads when someone is already helping with your problem!
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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