View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Mike H Mike H is offline
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 ***