C
c1802362
Can anyone enlighten me on the fundamental difference why the same VBA
code runs at such different speeds on Macs vs. PCs?
Here's an example. I wrote some code months ago on my PC at work (Dell
1.73GHz/504 mB RAM/Windows XP). The task involved transposing 4000+
data records from a columnar listing to a tabulated format. The source
data was comprised of column A which listed the label name of each
field in the record. Column B carried the corresponding data for each
field. Between each record there was a blank cell, so each record's
field labels were repeated in column A. The only other nuance was that
each record did not carry the same number of fields, so I had to code
the macro to read to the end of each record in column B before copying
and transposing it to the table. I accomplished this by creating a
loop that read the data in each field into an array until it reached a
blank cell, then created another loop to write out the array to the
table. On the PC it took about 2 minutes 30 seconds to complete the
task.
I took the code home to run the same file on my Mac (iMac G5 1.8 GHz/
1GB RAM/OS X 10.5). It took more than 8 hours to run the same code!
A few weeks ago, I recoded the macro to make the task more efficient.
This time around I used 'Range(ActiveCell,
ActiveCell.End(xlDown)).Select' to grab the entire record at once
before transposing it to the table. Now the PC version runs in under 3
seconds. The Mac takes 2 minutes and 20 seconds.
Can someone explain what is inherent in the Mac that doesn't allow it
to process code as fast as the PC?
Art
code runs at such different speeds on Macs vs. PCs?
Here's an example. I wrote some code months ago on my PC at work (Dell
1.73GHz/504 mB RAM/Windows XP). The task involved transposing 4000+
data records from a columnar listing to a tabulated format. The source
data was comprised of column A which listed the label name of each
field in the record. Column B carried the corresponding data for each
field. Between each record there was a blank cell, so each record's
field labels were repeated in column A. The only other nuance was that
each record did not carry the same number of fields, so I had to code
the macro to read to the end of each record in column B before copying
and transposing it to the table. I accomplished this by creating a
loop that read the data in each field into an array until it reached a
blank cell, then created another loop to write out the array to the
table. On the PC it took about 2 minutes 30 seconds to complete the
task.
I took the code home to run the same file on my Mac (iMac G5 1.8 GHz/
1GB RAM/OS X 10.5). It took more than 8 hours to run the same code!
A few weeks ago, I recoded the macro to make the task more efficient.
This time around I used 'Range(ActiveCell,
ActiveCell.End(xlDown)).Select' to grab the entire record at once
before transposing it to the table. Now the PC version runs in under 3
seconds. The Mac takes 2 minutes and 20 seconds.
Can someone explain what is inherent in the Mac that doesn't allow it
to process code as fast as the PC?
Art