danelskibr
Board Regular
- Joined
- Dec 31, 2014
- Messages
- 58
Hello,
The code below works fine. The problem is that it is very slow and clunk. I am not knowledgeable enough to find a better wat to make it work more efficiently.
WHAT IT DOES: In an alphabetically sorted column, it rinds each row with the word "Benchmark" and deletes that row. It does this until no Benchmarks remain and then it errors. I have it set to move along once it reaches the error.
WHAT I WANT IT TO DO: Find the first row with the word "Benchmark" in column B. Select down to the last row with the word Benchmark in Column B, and delete these rows.
Thanks for your help!
The code below works fine. The problem is that it is very slow and clunk. I am not knowledgeable enough to find a better wat to make it work more efficiently.
WHAT IT DOES: In an alphabetically sorted column, it rinds each row with the word "Benchmark" and deletes that row. It does this until no Benchmarks remain and then it errors. I have it set to move along once it reaches the error.
WHAT I WANT IT TO DO: Find the first row with the word "Benchmark" in column B. Select down to the last row with the word Benchmark in Column B, and delete these rows.
Code:
Dim StopCell3 As Range
Set StopCell3 = Columns("B").Find("Benchmark", Cells(Rows.Count, "B"), xlValues, xlWhole, xlNext, True)
On Error Resume Next
Do
Set StopCell3 = Columns("B").Find("Benchmark", Cells(Rows.Count, "B"), xlValues, xlWhole, xlNext, True)
Range(StopCell3, StopCell3.Offset(0, 0)).Select
Selection.EntireRow.Delete
Selection.End(xlDown).Offset(1, 0).Select
Loop While Not StopCell3 Is Nothing
On Error GoTo 0
Thanks for your help!