+ Reply to Thread
Results 1 to 2 of 2

macro to find a row with a certain value, then delete that row and the next 13 rows

Hybrid View

  1. #1
    Registered User
    Join Date
    08-24-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    15

    macro to find a row with a certain value, then delete that row and the next 13 rows

    I am copying data from a web page where the first (X) rows contain values that I need to keep. Then starting with the row where the left 22 characters = Window Cleaning Ground, I need to delete this and the next 13 rows following it.
    There are never more than 75 rows and the value to check is in column A.

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,659

    Re: macro to find a row with a certain value, then delete that row and the next 13 rows

    Sub Delete_Rows()
        Dim Found As Range
        Set Found = Range("A:A").Find(What:="Window Cleaning Ground*", _
                                      LookAt:=xlWhole, _
                                      SearchDirection:=xlNext, _
                                      MatchCase:=False)
        If Not Found Is Nothing Then
            Found.Resize(14).EntireRow.Delete
        Else
            MsgBox "Could not locate row. ", vbInformation, "No Match Found"
        End If
    End Sub

+ 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