Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,123
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 2 July 11th 06 05:50 PM
Linking a Specific Word to a Specific Number [email protected] Excel Worksheet Functions 1 July 11th 06 04:29 PM
Merge Excel data into specific form areas in a Word Doc duugg Excel Discussion (Misc queries) 1 April 21st 06 08:25 PM
Linking table in Excel to word travis Links and Linking in Excel 1 November 19th 05 02:30 PM
How do I count a named range for a specific word or acronym? brandyb Excel Worksheet Functions 1 November 4th 05 07:50 PM


All times are GMT +1. The time now is 09:38 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"