Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 397
Default VB to find text and delete that row and three beneath it

Hi There,

I have a large amount of consolidated data on a sheet called Master. I
need some VB that looks only in column F for the word "Cleared". When it
finds it, needs to select that line, and 3 beneath it (ie four in total)
and delete those 4 rows, then move on to the next instance of cleared,
select the 3 rows beneath it and delete all four rows, etc etc for all
instances in that column....

Any ideas?

Regars

D

*** Sent via Developersdex http://www.developersdex.com ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default VB to find text and delete that row and three beneath it

Darin,

Right click the sheet tab, view code and paste this in:-

Sub sonic()
lastrow = Range("F65536").End(xlUp).Row
For x = lastrow To 1 Step -1
Cells(x, 6).Select
If ActiveCell.Value = "Cleared" Then
ActiveCell.EntireRow.Select
Selection.Resize(4, 256).Select
Selection.Delete Shift:=xlUp
End If
Next
End Sub


Mike

"Darin Kramer" wrote:

Hi There,

I have a large amount of consolidated data on a sheet called Master. I
need some VB that looks only in column F for the word "Cleared". When it
finds it, needs to select that line, and 3 beneath it (ie four in total)
and delete those 4 rows, then move on to the next instance of cleared,
select the 3 rows beneath it and delete all four rows, etc etc for all
instances in that column....

Any ideas?

Regars

D

*** Sent via Developersdex http://www.developersdex.com ***

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
Shapes beneath cell text? tskogstrom Excel Discussion (Misc queries) 2 October 4th 07 08:57 AM
Find and Replace - delete the remainder of the text in the cell after my Find [email protected] Excel Programming 4 August 4th 07 03:39 AM
find text delete row okrob Excel Programming 5 January 17th 07 06:46 PM
Excel Macro find non zero value in cell and insert row beneath TimkenSteve Excel Programming 5 September 14th 06 07:26 PM
find and delete text, find a 10-digit number and put it in a textbox Paul Excel Programming 3 November 16th 04 04:21 PM


All times are GMT +1. The time now is 11:26 PM.

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

About Us

"It's about Microsoft Excel"