Formatting the code can help when you are trying to look at the bigger picture, so I suggest that you start with making sure that your code is much, much more readable, this will help you discover other things that you can change to make this code more efficient, let's just start with the formatting.
Here is your code
Sub jbeck1()
Dim i As Long
Dim LR As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
LR = Cells(Rows.Count, 1).End(xlUp).Row
For i = LR To 2 Step -1
If Range("E" & i) = "0020" Then
Range("E" & i).EntireRow.Delete Shift:=xlUp
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.Run "jbeck2"
End Sub
Sub jbeck2()
Dim i As Long
Dim LR As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
LR = Cells(Rows.Count, 1).End(xlUp).Row
For i = LR To 2 Step -1
If Range("E" & i) = "0021" Then
Range("E" & i).EntireRow.Delete Shift:=xlUp
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.Run "jbeck3"
Here is what it looks like after you:
- Indent the code inside
sub
's
- Indent the code inside
For
loops
- Include the
End Sub
for the second Sub
Sub jbeck1()
Dim i As Long
Dim LR As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
LR = Cells(Rows.Count, 1).End(xlUp).Row
For i = LR To 2 Step -1
If Range("E" & i) = "0020" Then
Range("E" & i).EntireRow.Delete Shift:=xlUp
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.Run "jbeck2"
End Sub
Sub jbeck2()
Dim i As Long
Dim LR As Long
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
LR = Cells(Rows.Count, 1).End(xlUp).Row
For i = LR To 2 Step -1
If Range("E" & i) = "0021" Then
Range("E" & i).EntireRow.Delete Shift:=xlUp
End If
Next i
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.Run "jbeck3"
End Sub
I also removed unnecessary newlines from the for loops, since now you can see them because they are properly indented.
All of this makes it easier to read. When I first looked at your code I thought it was one Sub
and then when I went to put the indentation in I realized that this is actually 2 Sub
's, that makes a big difference in how you look at the code.