bthurman1220
New Member
- Joined
- Oct 24, 2019
- Messages
- 11
I am using the code below to search cells for certain criteria and then keeping certain
rows and deleting certain rows.
This code currently takes around 1 hour to process 95,000 records. I need help in
determining if there is a better way.
Thanks,
rows and deleting certain rows.
This code currently takes around 1 hour to process 95,000 records. I need help in
determining if there is a better way.
Thanks,
Code:
'Delete Level 1's and certain Level 2's
X = 2
Dim vLvlDel As Long
vLvlDel = 1
Do Until Cells(X, 1) = ""
vLvl = Cells(X, 14)
vJobCode = Cells(X, 16)
Application.StatusBar = "Working on Row " & vLvlDel
Select Case vLvl
Case "Level 1"
Cells(X, 1).EntireRow.Delete
Case "Level 3"
X = X + 1
Case "Level 4"
X = X + 1
Case "Level 2"
Select Case vJobCode
Case "10127"
X = X + 1
Case "10205"
X = X + 1
Case "10206"
X = X + 1
Case "11414"
X = X + 1
Case "11428"
X = X + 1
Case "11754"
X = X + 1
Case "11769"
X = X + 1
Case Else
Cells(X, 1).EntireRow.Delete
End Select
End Select
vLvlDel = vLvlDel + 1
Loop
MsgBox vLvlDel & " Rows Processed"