Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
' Delete all lines
Dim lin As Line For Each lin In ActiveSheet.Lines If lin.Name Like "Line*" Then lin.Delete End If Next The longer I have worked on the project with this code, the more sluggish this seemed to be. Each time I run the macro with this code It will create 300-500 line segments. This delete code is the 1st thing that is done to clear out all lines from the previous execution and then re-draw the lines based on current data. The code that draws the lines has much more meat to its code, (lots of loops and conversions) but it runs very fast (a matter of seconds). As I step through the code (single step), the cursor seems to hang on the lin.Delete for about 1-3 seconds, Of course watching the execution i'm sure takes significantly longer, but I have seen this macro take about 3-5 minutes to complete it's deleting of all the lines. As the lines are being created I question the autonumber that is generated, Line15023 for example, I am wondering if that might be causing some overhead. Is there a more efficient way to delete all lines? I have also added code to turn off "calculation" before the deletes and turning recalc back on afterwards, but that didnt seem to help. -- Regards, John |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to execute the fill function down a long column | Excel Discussion (Misc queries) | |||
Execute vba code on cell exit | Excel Discussion (Misc queries) | |||
my excel formulas are too long to execute find and replace | Excel Worksheet Functions | |||
When does Code Execute on a List Box? | Excel Programming | |||
execute code for all 12 months | Excel Programming |