elephant97
Board Regular
- Joined
- Sep 18, 2002
- Messages
- 63
I'm running a FOR,NEXT loop that is just plain slow. What options do I have to speed up the code written below so that I'm not waiting forever for it to run? THanks
With Worksheets("Sheet1")
For rw = .Cells(10000, 1).End(xlUp).Row To 2 Step -1
If .Cells(rw, 1).Value = "BS " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 1).Value = "S1 " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 1).Value = "S2 " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 1).Value = "S3 " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 2).Value = 108 Then .Cells(rw, 2).EntireRow.Delete
If .Cells(rw, 2).Value = 901 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 902 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 903 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 904 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 905 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 906 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 912 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 913 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, .Value > 24 And .Cells(rw, .Value > 100 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 13).Value <> "ST" Then .Cells(rw, 13).EntireRow.Delete
99 Next
End With
I'm New, please be easy Thanks!!!
With Worksheets("Sheet1")
For rw = .Cells(10000, 1).End(xlUp).Row To 2 Step -1
If .Cells(rw, 1).Value = "BS " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 1).Value = "S1 " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 1).Value = "S2 " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 1).Value = "S3 " Then .Cells(rw, 1).EntireRow.Delete
If .Cells(rw, 2).Value = 108 Then .Cells(rw, 2).EntireRow.Delete
If .Cells(rw, 2).Value = 901 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 902 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 903 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 904 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 905 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 906 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 912 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 2).Value = 913 And .Cells(rw, .Value > 24 And .Cells(rw, .Value > 48 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, .Value > 24 And .Cells(rw, .Value > 100 Then .Cells(rw, .EntireRow.Delete
If .Cells(rw, 13).Value <> "ST" Then .Cells(rw, 13).EntireRow.Delete
99 Next
End With
I'm New, please be easy Thanks!!!