Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 208
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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" wrote in message ...
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
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
Delete rows with specific text David New Users to Excel 5 April 3rd 23 07:29 PM
Delete Rows Without Specific Text waggett Excel Worksheet Functions 6 October 6th 09 11:34 AM
select and delete specific rows Paulg Excel Discussion (Misc queries) 1 August 22nd 06 04:12 PM
Delete rows with specific text MAYDAY[_3_] Excel Programming 8 June 7th 05 08:38 PM
Macro to delete specific rows Steve Excel Programming 12 October 1st 04 11:50 PM


All times are GMT +1. The time now is 01:26 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"