Results 1 to 2 of 2

code:Find and Delete

Threaded View

  1. #1
    Registered User
    Join Date
    10-16-2008
    Location
    St. Louis
    Posts
    6

    code:Find and Delete

    Wrote the below VB and it worked once but I may have made a mess of things with a series of Cut and Pastes. Want Excel to find specific phrases or words in a specific column and delete them.

    Option Explicit
    
    Sub delRows()
        Dim cl     As Range
        Dim uRng   As Range
        Dim rng    As Range
        Dim x      As Long
    
        Set uRng = ActiveSheet.UsedRange
        For Each cl In uRng
            If cl.Value = "Not Rated  |  Write a Review" Or cl.Value = "Click on the More Info button to learn about this business." Or cl.Value = "More Info" Or cl.Value = "Map It" Then
                If x = 0 Then
                    Set rng = cl
                    x = 1
                Else: Set rng = Union(rng, cl)
                End If
            End If
        Next cl
        rng.EntireRow.Delete
    
    End Sub


    Attachment is included
    Attached Files Attached Files
    Last edited by billkelley; 10-09-2009 at 03:37 PM. Reason: correct code tags "#"

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