|Go back to All Questions||Login or Register|
Hi, I realize that the example given is only for 1 for loop. What if I need to use more than 1 for loop? Is it possible to make it?
For i = 1 to 10
for j = 1 to 10
for k = 1 to 1000
worksheets(i).cells(k, j) = i + j + k
Thank you very much,
if you want your results posted into your “master” workbook from all threads use the ParallelMethods.SaveRangeToMaster method which is coded based on the GetObject VBA method accessing the Excel master application worbook.
I would however not do this as you did in your example above as this would surely cause the processes to block, crash or slow down the execution (my best guess). Best way would be to save the results of each thread into an Array (3 D in your case) and then “dump” the entire Array in one go using the ParallelMethods.SaveRangeToMaster method.
Hope this helps.