![]() |
Delete all rows below The word Page: 2 of 25
Need to delete all rows below the word Page: 2 of 25
Do to the report it could be at any row however it usually is in cell Need to clean up the junk in a macro I sort by part but thiers trash below. Even tried to filter but it won't filter out Thanks DJ |
Delete all rows below The word Page: 2 of 25
Do you mean that in some cell you have "Page: 2 of 25"? And it usually is
in Column V? But not always? One way: Sub DeleteRows() Dim FoundCell As Range Set FoundCell = ActiveSheet.UsedRange. _ Find(What:="Page: 2 of 25", LookAt:=xlWhole) On Error GoTo NotFound Range("A" & FoundCell.Row + 1, Range("A" & Rows.Count)). _ EntireRow.Delete On Error GoTo 0 Exit Sub NotFound: On Error GoTo 0 MsgBox "Text not found." End Sub "Duncan J" wrote in message ... Need to delete all rows below the word Page: 2 of 25. Do to the report it could be at any row however it usually is in cell V Need to clean up the junk in a macro I sort by part but thiers trash below. Even tried to filter but it won't filter out. Thanks, DJ |
Delete all rows below The word Page: 2 of 25
That works great. I needed to delete the text Page: 2 of 25. I did a find replace on that and stuck it in the macro
I sorted my part number so all above the text Page: 2 of 25 is great and the junk below needs to be deleted. This worked for me Thanks DJ |
Delete all rows below The word Page: 2 of 25
Duncan
The FoundCell is the cell than contains the text you searched for. You don't need to Find/Replace it to clear it. If you want to delete that text, just say: FoundCell.ClearContents Glad it worked for you. Otto "Duncan J" wrote in message ... That works great. I needed to delete the text Page: 2 of 25. I did a find replace on that and stuck it in the macro. I sorted my part number so all above the text Page: 2 of 25 is great and the junk below needs to be deleted. This worked for me! Thanks, DJ |
All times are GMT +1. The time now is 09:11 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com