I have some code containing a for next loop, which loops through the rows in my range in reverse from bottom to top, and conditionally deletes entire rows from my range, if condition 1, 2, 3, 4 or 5 are true. There is about 4,000 rows in my range of data. This section of the code is taking about 10 minutes to run, and I need to speed things up. Here is the pertinent section of code:
Is there a faster way to accomplish the same thing without looping through each row individually?
Thanks,
Kevin
Code:
For i = LastRow To 3 Step -1
If (Cells(i, 4).Value <> "Broadband Service" And Cells(i, 4).Value <> "Business Service" And Cells(i, 4).Value <> "Residential Service" And Cells(i, 4).Value <> "Video Service") _
Or (Cells(i, 8).Value = "Upgrade" And (Cells(i, 18).Value = True Or Cells(i, 4).Value <> "Broadband Service")) _
Or ((Cells(i, 4).Value = "Business Service" Or Cells(i, 4).Value = "Residential Service") And (Cells(i, 5).Value <> "ACCMLB" And Cells(i, 5).Value <> "ACCRES" And Cells(i, 5).Value <> "ACCSLB")) _
Or (Cells(i, 4).Value = "Broadband Service" And (Left(Cells(i, 5).Value, 3) <> "HSI" Or Cells(i, 5).Value = "HSICRED" Or Cells(i, 5).Value = "HSI100CR" Or Cells(i, 5).Value = "HSIEMP" Or Cells(i, 5).Value = "HSIINST") _
Or (Cells(i, 4).Value = "Video Service" And (Cells(i, 5).Value <> "BASIC" And Cells(i, 5).Value <> "DTVEXPAND" And Cells(i, 5).Value <> "DTVEXPANDUP" And Cells(i, 5).Value <> "DTVLOCALPLUS") _
Then Cells(i, 4).EntireRow.Delete
Next
Is there a faster way to accomplish the same thing without looping through each row individually?
Thanks,
Kevin