Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Deleting a Row if it contains a specific word
I want to develop a macro that will search through a worksheet and delete any
row(s) that contains the word "Step". The word could occur anywhere within any cell in the row. Thanks for any help offered. |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Deleting a Row if it contains a specific word
Hi Steve
Look here for a few ways http://www.rondebruin.nl/delete.htm Try Sub Example1() Dim Firstrow As Long Dim Lastrow As Long Dim Lrow As Long Dim CalcMode As Long Dim ViewMode As Long With Application CalcMode = .Calculation .Calculation = xlCalculationManual .ScreenUpdating = False End With ViewMode = ActiveWindow.View ActiveWindow.View = xlNormalView Firstrow = ActiveSheet.UsedRange.Cells(1).Row Lastrow = ActiveSheet.UsedRange.Rows.Count + Firstrow - 1 With ActiveSheet .DisplayPageBreaks = False For Lrow = Lastrow To Firstrow Step -1 If Application.WorksheetFunction.CountIf(.Rows(Lrow), "Step") 0 Then .Rows(Lrow).Delete End If Next End With ActiveWindow.View = ViewMode With Application .ScreenUpdating = True .Calculation = CalcMode End With End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Steve Madsen" <Steve wrote in message ... I want to develop a macro that will search through a worksheet and delete any row(s) that contains the word "Step". The word could occur anywhere within any cell in the row. Thanks for any help offered. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Linking a Specific Word to a Specific Number | Excel Worksheet Functions | |||
Linking a Specific Word to a Specific Number | Excel Worksheet Functions | |||
Merge Excel data into specific form areas in a Word Doc | Excel Discussion (Misc queries) | |||
Linking table in Excel to word | Links and Linking in Excel | |||
How do I count a named range for a specific word or acronym? | Excel Worksheet Functions |