ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete Rows above a certain point (https://www.excelbanter.com/excel-programming/280810-re-delete-rows-above-certain-point.html)

steve

Delete Rows above a certain point
 
Julie,

This worked in Excel97

Dim rng As Range
Set rng = Columns(1).Find("Report")
If Not rng Is Nothing Then
Range(Rows(1), Rows(rng.Row - 1)).Delete
Else
MsgBox "Not found"
End If


--
sb
"Julie" wrote in message
...
Is there anyway to delete rows above a certain point?

I have a document that I import and my data varies each
time. I want to create a macro to find a certain word in
my report and then delete all the rows above that row.

Ex: If I have a row in my report (in column A)
called "Report Analysis", I want all of the rows above
that word to be deleted.

Note: The word is never in the same row number.
Sometimes it is Column A, Row 20 and sometimes it is
Column A, Row 30.

Thanks in advance for any help!
Julie





All times are GMT +1. The time now is 06:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com