+ Reply to Thread
Results 1 to 2 of 2

Record deleteing macro based on keywords

  1. #1
    Registered User
    Join Date
    10-07-2009
    Location
    Long Beach, CA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Record deleteing macro based on keywords

    Here is my current Macro:

    Sub DeleteRows()
    Dim rng As Range
    Do
    If Not rng Is Nothing Then
    rng.EntireRow.Delete
    End If
    Set rng = Cells.Find(What:="arbys", _
    After:=ActiveCell, _
    LookIn:=xlFormulas, _
    LookAt:=xlPart, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    Loop While Not rng Is Nothing

    Do
    If Not rng Is Nothing Then
    rng.EntireRow.Delete
    End If
    Set rng = Cells.Find(What:="bagel", _
    After:=ActiveCell, _
    LookIn:=xlFormulas, _
    LookAt:=xlPart, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    Loop While Not rng Is Nothing

    End Sub

    Currently it deletes an entire record if it finds "bagel" or "arbys" anywhere in the record. I want the macro to only delete records if the value is found in the following column headers "OPERATION" and/or "CATEGORY". If "bagel" or "arbys" is found in any other column I want the record to not necessarily be "kept" but only removed if those key words are found in either of the two column headers specified.

  2. #2
    Registered User
    Join Date
    10-07-2009
    Location
    Long Beach, CA
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Record deleteing macro based on keywords

    Thanks to anyone that can help

+ 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