OfficeUser
Well-known Member
- Joined
- Feb 4, 2010
- Messages
- 544
- Office Version
- 365
- 2016
- Platform
- Windows
I use this code to filter out any dates outside of the range I place on the userform this code is part of. Anyone have any suggestions to speed it up. The dates I filter start in 06' I would only need dates from 10' on. Perhaps I could dump those rows first. Thoughts? Thanks!!
Code:
Sub DateRangeSort()
Application.ScreenUpdating = False
Sheets("Sheet1").Select
Dim DT As Date: Dim DTT As Date
DT = UserForm1.TextBox4.Text 'UserformDate
DTT = UserForm1.TextBox5.Text
a = 1
st:
If Cells(a, 1) = "" Then GoTo endd
If Cells(a, 1) <= DTT And Cells(a, 1) >= DT Then a = a + 1: GoTo st
Cells(a, 1).Select
Selection.EntireRow.Delete
GoTo st
endd:
Application.ScreenUpdating = True
End Sub