Recently changed a new computer, but found the same macro program, the speed of the new computer should run more slowly, please you higher-ups,
First stick test code, test code is array assignment, and the output of an array into a cell,
Sub AAA ()
Dim arrA As the Variant
Dim As Integer I
Dim As Integer p
Dim StartTime As Date
StartTime=Timer
'
array assignmentReDim arrA (30, 4)
For I=0 To UBound (arrA, 1)
For q=0 To UBound (arrA, 2)
ArrA (I, q)=1
The Next q
Next I
'carefully checked, mainly the following the longest line array output code,
Range (" b2 "). The Resize (UBound (arrA, 1) + 1, UBound (arrA, 2) + 1)=arrA
MsgBox Format (Timer - StartTime, "0.00" & amp; "Seconds")
End Sub
Copy the code
New computer configuration is as follows:
New computers EXCEL version is as follows:
Old computer configuration is as follows:
Old computers EXCEL version is as follows:
The present question is that new computer configuration higher speed faster, but the same code takes longer need new computer more minutes 1 seconds, old computer takes just 0.3 seconds, is this why??
And I also understand the main time-consuming statement is an array output code this statement, the old and new computer time difference is also in this way,
Beg your higher-ups grant instruction, or tell me a way of thinking can,