I have a pretty intense macro and I noticed that it takes baout 30 seconds to run... So I did my redneck timing and put:
Then I put a break before the code ends to be able to see the constraints. I found that my macro runs in under 3 seconds if I delete this line of code:
Full context:
Where ColumnCNT is set to 500. totColumns is set to ColumnCNT at the start. totMonths starts of as Zero (0).
If I allow that line of code it takes an average of 25 seconds to complete.
Question: Is there something I can do to speed up the deletion of columns?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008
Code:
t1 = now()
t2 = now()
...
Then I put a break before the code ends to be able to see the constraints. I found that my macro runs in under 3 seconds if I delete this line of code:
Code:
Columns(a).Delete
Full context:
Code:
For a = ColumnCNT To 21 Step -1
If Left(UCase(Cells(10, a).Value), 5) <> "TOTAL" Then
'Columns(a).Delete
totColumns = totColumns - 1
ElseIf Cells(10, a).Interior.Color = RGB(238, 236, 225) Then
totMonths = totMonths + 1
End If
Next a
If I allow that line of code it takes an average of 25 seconds to complete.
Question: Is there something I can do to speed up the deletion of columns?
- Matt
"If I must boast, I will boast of the things that show my weakness"
- Windows 2003 Server, 98 SE, XP
- VB.NET, VSTS 2010, ASP.NET, EXCEL VBA, ACCESS, SQL 2008