View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default a small question

It isn't clear whether you want the 2 rows below the cell or a single row 2
rows below the cell. This does 2 rows below the cell.

Sub findkeyword()
Dim cell As Range
Dim myKeyword

myKeyword = "clue"
Set cell = Cells.Find(myKeyword)
If Not cell Is Nothing Then
Range("A4:E" & cell.Row - 1).ClearContents
cells(cell.row+1,"F").Resize(2,3).ClearContents
End If
End Sub


cells(cell.Row + 2).Resize(1,3).Clearcontents
would be the single row 2 rows below.

--
Regards,
Tom Ogilvy


"Jimmy Pop" wrote in message
oups.com...
Hello,
I have the following code to look for a keyword and then clear the
contents of the cells from columns A to E above the specified word..

Sub findkeyword()
Dim cell As Range
Dim myKeyword

myKeyword = "clue"
Set cell = Cells.Find(myKeyword)
If Not cell Is Nothing Then
Range("A4:E" & cell.Row - 1).ClearContents
End If
End Sub

I want to also delete cells F, G, and H located on 2 rows below the
keyword. Can someone help me with that coding?

Thanks,
jimmy.pop