View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Delete Rows below a certain cell

Julie,

This worked in Excel97 [watch word wrap]

Dim x As Long, y As Long
'
x = Columns("C:C").Find(What:="report", After:=ActiveCell,
LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Row
y = Selection.SpecialCells(xlCellTypeLastCell).Row
Range(Rows(x), Rows(y)).EntireRow.Delete

If 'report' appears in any column, change
Columns("C:C").
to
Cells.
--
sb
"Julie" wrote in message
...
Hi! I have a question regarding macros in Excel. Can
you create a macro to go to a certain cell and then
delete that cell and the cells after that that contain
data?

For example:
I have a report that I have imported into Excel. On row
20, in Column "C", I have a heading called "**Report
Status**". I want the macro to go to that cell and
delete all the rows below it that contain data.

FYI...The heading is not always on row 20 in column "C".
The row varies each time I import data!

I appreciate any help that can be given!

Julie