Conditional Row Delete

NMB311

New Member
Joined
May 28, 2010
Messages
14
I would like to delete any row in my worksheet that contains the word "Page" and the next 7 rows after it. Is there an easy way to do this?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Is "Page" in any particular column ?
 
Upvote 0
Test this on a copy of your data.

Code:
Sub Delete_Page_Rows()

    Dim FoundPage As Range
    
    Set FoundPage = ActiveSheet.Cells.Find(What:="Page", _
                                           LookIn:=xlValues, _
                                           LookAt:=xlPart, _
                                           MatchCase:=False)
    Application.ScreenUpdating = False
    Do Until (FoundPage Is Nothing)
        FoundPage.EntireRow.Resize(8).Delete
        Set FoundPage = ActiveSheet.Cells.Find(What:="Page")
    Loop
    Application.ScreenUpdating = True
    MsgBox "Delete ""Page"" rows complete."
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,520
Messages
6,179,270
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top