cameronfraser
Programmer
I wrote a macro to go through a list of items and eliminate all repeating items. When I execute the macro it runs very slowly. I can actually make it go faster by stepping through the code. Also, when the code is running, if I hold down the space bar or any character key it runs faster. What is happening?
Here is the code that is running so slowly:
Do
If ActiveCell.Offset(1, 0) = ActiveCell Then
ActiveCell.Formula = ""
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell = ""
Screen updating true or false has no affect. I do know that it is the line ActiveCell.Formula = "" that makes the macro go slow, because if I comment it out this macro blazes. Note: I also tried the line ActiveCell.Formula.Clear and it still turtled.
Here is the code that is running so slowly:
Do
If ActiveCell.Offset(1, 0) = ActiveCell Then
ActiveCell.Formula = ""
End If
ActiveCell.Offset(1, 0).Select
Loop Until ActiveCell = ""
Screen updating true or false has no affect. I do know that it is the line ActiveCell.Formula = "" that makes the macro go slow, because if I comment it out this macro blazes. Note: I also tried the line ActiveCell.Formula.Clear and it still turtled.