在VBA代码中使用命名单元会减慢宏的速度吗?

问题描述 投票:0回答:1

在VBA代码中使用命名单元会减慢宏的速度吗?

我假设,如果您在VBA代码中使用一个或两个命名的单元格/范围,则不会对其执行时间产生很大影响。但是,我很好奇命名单元格/范围的过度使用是否会减慢宏的速度。

excel vba performance named-ranges
1个回答
0
投票

我还没有测试这种情况。但是我发现了以下信息。它可能会帮助您。

Named Ranges:
1. allows users to save time
2. enhances automated data analysis
But:
3. increases the size of files and significantly 
   slows down basic Excel functionality.

参考:https://medium.com/@rzacharia/excel-named-ranges-the-good-and-the-really-ugly-894e04fb16e5

命名范围对VBA执行的影响:

取决于您的使用方式。例如,如果您创建了大量命名范围,并且正在循环调用它们,那么它将降低性能。因为每次excel都需要解析名称。

并且如果您使用Range(“ A1:A10”)代替命名范围,则与命名范围相比,Excel不需要执行任何额外的操作。

Conclusion:

1. If you are using Named Range with limited number then it may not create any issue.
2. But if you are using large number of Named Ranges then it may slow down the performance.

希望这会对您有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.