ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range.Delete and Range.Resize.Name performance issues (https://www.excelbanter.com/excel-programming/323170-range-delete-range-resize-name-performance-issues.html)

Test.File

Range.Delete and Range.Resize.Name performance issues
 
I have some code that

a) Deletes cells in a range (Shift:=xlLeft)
b) Inserts cells (Shift:=xlToRight)
c) and then, resizes the ranges and assigns the same name.

Example:

Set Global_Board = Range("Select.Method.Results")
a)
Global_Board.Offset(-3, 1).Resize(NbLayerMax + 4, Global_Board.Columns.Count
- 1).Delete Shift:=xlToLeft

b & c) With Global_Board
.Offset(-3, 1).Resize(NbLayerMax + 4, NBMethod_Selected - 1).Insert
Shift:=xlToRight
.Resize(, NBMethod_Selected).name = "Select.Method.Results"
End With

There are 3 such ranges that these operations are being performed upon.

I've noticed that there's a signicant cumulative delay in performing these
steps when the code is run repeatedly. Over 20 iterations, it can grow to
several seconds. The size of the ranges is typically 10rx1c.

Is there a workaround? How else can I change this (inherited) code?

Thanks



All times are GMT +1. The time now is 03:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com