简体   繁体   English

使用 VBA 在 Excel 中将大数组返回到工作表的性能问题

[英]Performance issue with returning huge array to worksheet in Excel using VBA

I'm trying to automize the classification of notifications within an excel sheet, using VBA.我正在尝试使用 VBA 自动化 Excel 工作表中的通知分类。

I think I managed to get a decent performant classification algorithm going, but the problem is returning the classification to the Excel worksheet.我想我设法获得了一个不错的高性能分类算法,但问题是将分类返回到 Excel 工作表。 The issue is pretty straightforward => the row-count of the excel sheets is around 27k rows.问题非常简单 => excel 表的行数约为 27k 行。

In the other dimension the array has 3 columns.在另一个维度中,数组有 3 列。 I'm using this code to write back the array:我正在使用此代码写回数组:

Range("M2:O" & UBound(return) + 1).FormulaArray = return

where return is the 2D-array.其中 return 是二维数组。 Is there any way to get a better performing code, or do I simply have to live with it.有什么方法可以获得更好的代码,还是我必须忍受它。

shrivallabha-redij had the perfect solution, simply using .Value instead of .FormulaArray . shrivallabha-redij有完美的解决方案,只需使用.Value而不是.FormulaArray

Reduced the time to a few seconds将时间减少到几秒钟

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM