Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Slow running code
I am trying to delete or clear out duplicate rows based on a few cells that
match. The cells other than those in the B, C & M columns may not match. The below code works but runs very slowly (takes about 5 seconds per row). Anyone know of a better (faster) way? For RowIndex = 2 To 2000 If Range("B" + CStr(RowIndex)) = Range("B" + CStr(RowIndex + 1)) And _ Range("C" + CStr(RowIndex)) = Range("C" + CStr(RowIndex + 1)) And _ Range("M" + CStr(RowIndex)) = Range("M" + CStr(RowIndex + 1)) Then Range("A" + CStr(RowIndex) + ":" + "Z" + CStr(RowIndex)) = "" End If Next |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Slow running code
turn off calculation and screenupdating before the code and then turn it back on after it runs With Application .ScreenUpdating = False .Calculation = xlCalculationManual End With ' your code With Application .ScreenUpdating = True .Calculation = xlCalculationAutomatic End With -- Gary "Scott" wrote in message ... I am trying to delete or clear out duplicate rows based on a few cells that match. The cells other than those in the B, C & M columns may not match. The below code works but runs very slowly (takes about 5 seconds per row). Anyone know of a better (faster) way? For RowIndex = 2 To 2000 If Range("B" + CStr(RowIndex)) = Range("B" + CStr(RowIndex + 1)) And _ Range("C" + CStr(RowIndex)) = Range("C" + CStr(RowIndex + 1)) And _ Range("M" + CStr(RowIndex)) = Range("M" + CStr(RowIndex + 1)) Then Range("A" + CStr(RowIndex) + ":" + "Z" + CStr(RowIndex)) = "" End If Next |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
here is my code...it's running a bit slow though..any ideas to make it more efficient? thanks | Excel Programming | |||
Workbook running VERY slow | Excel Discussion (Misc queries) | |||
Slow Running Code to Hide Blank Rows | Excel Programming | |||
code running super slow... | Excel Programming |