ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro that deletes rows from cell containing End to end of data. (https://www.excelbanter.com/excel-discussion-misc-queries/151649-macro-deletes-rows-cell-containing-end-end-data.html)

Richard

Macro that deletes rows from cell containing End to end of data.
 
MS OS XP:
Excel 2000:

Need a macro that deletes all rows from the end of data up to a cell in
Colum A that contains the word End.

Example: If cell A(150) = €œEnd€ Then
Delete all rows from the end of data up to and including row 150.

Thanks in advanced,

--
Richard

Stephane Quenson

Macro that deletes rows from cell containing End to end of data.
 
Sub DeleteRowsAfterWordEnd()

Dim iRow As Long
Dim iCol As Long

iRow = 1
iCol = 1

While Cells(iRow, iCol) < "End"
iRow = iRow + 1
If iRow 65536 Then
Exit Sub
End If
Wend

Rows(Format(iRow, "0") & ":65536").Delete

End Sub


Don Guillett

Macro that deletes rows from cell containing End to end of data.
 
try this simple ditty
sub delrows()
fr=columns(1).find("End").row
lr=cells(rows.count,"a").end(xlup).row
rows(fr & ":" & lr).delete
end sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Richard" wrote in message
...
MS OS XP:
Excel 2000:

Need a macro that deletes all rows from the end of data up to a cell in
Colum A that contains the word End.

Example: If cell A(150) = €œEnd€ Then
Delete all rows from the end of data up to and including row 150.

Thanks in advanced,

--
Richard




All times are GMT +1. The time now is 09:20 PM.

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