VBA_Cancer
New Member
- Joined
- Nov 6, 2017
- Messages
- 17
So I got a code that deletes rows based on 2 column conditions. However, it's very slow.
I have about 60, 000 rows and this takes forever.
My data looks something like this:
Week number and year is sorted by oldest to newest.
Is there a much faster method?
Thanks
I have about 60, 000 rows and this takes forever.
VBA Code:
Sub ClearOldest()
OldestWeek = 34
OldestYear = 2018
i = 2
While Sheet5.Cells(i, "Q") = OldestWeek And Sheet5.Cells(i, "R") = OldestYear
Sheet5.Rows(i).EntireRow.Delete
i = i + 1
Wend
MsgBox "Mission Accomplished"
End Sub
My data looks something like this:
week | year | data1 | data2 |
33 | 2018 | 1335 | 353 |
33 | 2018 | 2323 | 353 |
34 | 2018 | 35223 | 33533 |
34 | 2018 | 353 | 3535 |
Week number and year is sorted by oldest to newest.
Is there a much faster method?
Thanks