Results 1 to 7 of 7

Find rows containing specific data and delete

Threaded View

kmlloyd Find rows containing specific... 01-05-2010, 05:09 PM
JBeaucaire Re: Find rows containing... 01-05-2010, 06:26 PM
kmlloyd Re: Find rows containing... 01-06-2010, 10:20 AM
JBeaucaire Re: Find rows containing... 01-06-2010, 01:12 PM
kmlloyd Re: Find rows containing... 01-06-2010, 01:26 PM
JBeaucaire Re: Find rows containing... 01-06-2010, 02:59 PM
kmlloyd Re: Find rows containing... 01-06-2010, 03:03 PM
  1. #1
    Forum Contributor
    Join Date
    11-18-2009
    Location
    Winnipeg
    MS-Off Ver
    Excel 2003
    Posts
    203

    Find rows containing specific data and delete

    I have a large report that I pull each month listing which products we sold last month. There are certain products I don't want included in the report. Until I can have the report re-written, I'm looking for a macro or a function that will find all the rows that contain these product numbers in column M and delete the entire row. The product numbers I need to delete are always the same, but some months one or more of them might not be in the report if they weren't sold.

    In Summary:

    Find in column M the product numbers:
    c1000
    316140a
    316140
    316295a
    316295
    316311a
    316311
    316451a
    316451
    316450a
    316450
    316452a
    316452

    Delete those rows containing the product numbers above

    Thanks in advance for any help!


    ETA: I found a code (below) but when I highlight my row and run the macro, it deletes the first instance, but then I get an error saying "Object Required"

    Sub Deleteit()
    Dim c As Range
    For Each c In Selection
    If c = "C1000" Then c.EntireRow.Delete
    If c = "316140" Then c.EntireRow.Delete
    If c = "316140A" Then c.EntireRow.Delete
    If c = "316295" Then c.EntireRow.Delete
    If c = "316295A" Then c.EntireRow.Delete
    If c = "316311" Then c.EntireRow.Delete
    If c = "316311A" Then c.EntireRow.Delete
    If c = "316451" Then c.EntireRow.Delete
    If c = "316451A" Then c.EntireRow.Delete
    If c = "316450" Then c.EntireRow.Delete
    If c = "316450A" Then c.EntireRow.Delete
    If c = "316452" Then c.EntireRow.Delete
    If c = "316452A" Then c.EntireRow.Delete
    Next
    End Sub
    Last edited by kmlloyd; 01-06-2010 at 03:03 PM.

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