+ Reply to Thread
Results 1 to 6 of 6

Delete Entire Row If...

  1. #1
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094

    Delete Entire Row If...

    Hello All,

    Just need a simple macro (I think) to delete an entire row if a particular word appears in column D. I searched the old posts but didn't come up with exactly what I needed.

    My range is A1:G15000. If the word "Classify" appears in column D then delete that entire row, if not skip and continue searching/deleting through the range.

    Any help would be much appreciated.

    TIA,

    Steve

  2. #2
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    A little twist to my op.

    I wish to delete rows that contain "Classify" in column D but also do not contain "Mail Room" in column A.

    TIA,

    Steve

  3. #3
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845
    Hi,


    This loops thru column "D" and looks for your word.
    Paste to a module.

    Please Login or Register  to view this content.
    Last edited by Charles; 11-13-2006 at 12:18 PM.
    Charles

    There are other ways to do this, this is but 1 !
    Be Sure you thank those who helped.
    IF YOU'RE SATISFIED BY ANY MEMBERS RESPONSE TO YOUR ISSUE PLEASE USE THE STAR ICON AT THE BOTTOM LEFT OF THE POST UNDER THEIR NAME.

  4. #4
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    Charles,

    Thanks for the response. I just tried it and got a compile error at the line formatted in red.


    Sub DeleteERow()
    Application.ScreenUpdating = False
    Dim i As Integer
    For i = Range("D65536").End(xlUp).Row To 1 Step -1
    If Cells(i, 4).Value = "Classify" and Cells(i,1) .Value <> "Mail Room" Then
    Cells(i, 4).EntireRow.Delete
    End If
    Next i
    End Sub



    Any ideas?

    Thanks again,

    Steve

  5. #5
    Valued Forum Contributor
    Join Date
    03-25-2004
    Location
    Boston, MA US
    Posts
    1,094
    Charles,

    Got it. Spacing error was all. Thanks for your help.

    Cheers,

    Steve

  6. #6
    Valued Forum Contributor Charles's Avatar
    Join Date
    02-10-2004
    Location
    Biloxi
    MS-Off Ver
    Windows 7, Excel 2003,2007 & Mac2011
    Posts
    845
    Hi,

    Thanks for letting me know.
    Sorry for the typo.

+ 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