开发者

multi thread in Excel 2007 [duplicate]

This question already has answers here: Multi-threading in VBA (8 answers) Closed 5 years ago.

I have a question/problem on running a macro with some level of concurrency in Excel 2007.

Here is my situation.

(1) I am using Excel 2007

(2) My PC is an Intel Dual-Core.

(3) For this test, macro is very simple and defined in a module.

Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

Function simple_macro() Sleep 1000 simple_macro = "hello world" En开发者_运维知识库d Function

(4) I fill "=simple_macro()" in 100 x 100 cells in a worksheet.

(5) The time it takes to finish processing the macro is the same whether I enable or disable multi-thread features in option. It looks like the Excel scheduler is evaluating cells linearly...

It is understandable if my macro was doing some cpu-intensive processing, but as you can see it is quite simple and each cell is independent of others, thus it should finish within few seconds.

Do you have any suggestions to evaluate cells concurrently? Does Excel 2007 support multi-threading? (e.g. fully utilizing multiple CPU cores when evaluating)


Although the Excel 2007 calculation engine supports multithreading, Excel VBA does not.

So user defined functions written in VBA are treated as not threadsafe by Excel.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜