+ Reply to Thread
Results 1 to 2 of 2

Delete Rows With Specific Text

  1. #1
    Sean
    Guest

    Delete Rows With Specific Text

    I want to run a macro that will search through rows 1 to 1000, and will
    delete a section of rows when it finds the following

    Look for in column "A" the word "FURN" when it is located it will delete
    that row along with three rows beneath it and one row above it. It will stop
    at row 1000.

    Any suggestions?

    Thanks

    Sean

  2. #2
    Ron de Bruin
    Guest

    Re: Delete Rows With Specific Text

    Hi Sean

    You can test this on a copy of your workbook

    Sub FindExample1()
    Dim str As String
    Dim Rng As Range
    Dim I As Long

    Application.ScreenUpdating = False
    str = "FURN"

    Do
    Set Rng = Range("A:A").Find(What:=str, _
    After:=Range("A" & Rows.Count), _
    LookIn:=xlFormulas, _
    LookAt:=xlWhole, _
    SearchOrder:=xlByRows, _
    SearchDirection:=xlNext, _
    MatchCase:=False)
    If Not Rng Is Nothing Then Rng.Offset(-1, 0).Resize(5).EntireRow.Delete
    Loop While Not (Rng Is Nothing)

    Application.ScreenUpdating = True
    End Sub


    --
    Regards Ron de Bruin
    http://www.rondebruin.nl



    "Sean" <[email protected]> wrote in message news:[email protected]...
    >I want to run a macro that will search through rows 1 to 1000, and will
    > delete a section of rows when it finds the following
    >
    > Look for in column "A" the word "FURN" when it is located it will delete
    > that row along with three rows beneath it and one row above it. It will stop
    > at row 1000.
    >
    > Any suggestions?
    >
    > Thanks
    >
    > Sean




+ 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