Re: Enlighten me - Mac vs. PC processing speeds
- From: Jim Gordon MVP <goldkey74@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 25 Feb 2008 21:02:25 -0500
c1802362@xxxxxxx wrote:
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
Hi Art,
If you go into the Visual Basic Editor (VBE) and step through the code by pressing F8, are is there a particular command or operation that takes a long time to execute?
If so, can you post the offending code snippet here? Sometimes people know alternative methods that can be faster and they can post their suggestions in the newsgroup.
-Jim
--
Jim Gordon
Mac MVP
MVPs are independent experts who are not affiliated with Microsoft.
http://mvp.support.microsoft.com/
.
- Follow-Ups:
- Re: Enlighten me - Mac vs. PC processing speeds
- From: c1802362
- Re: Enlighten me - Mac vs. PC processing speeds
- References:
- Enlighten me - Mac vs. PC processing speeds
- From: c1802362
- Enlighten me - Mac vs. PC processing speeds
- Prev by Date: Enlighten me - Mac vs. PC processing speeds
- Next by Date: Re: Enlighten me - Mac vs. PC processing speeds
- Previous by thread: Enlighten me - Mac vs. PC processing speeds
- Next by thread: Re: Enlighten me - Mac vs. PC processing speeds
- Index(es):
Relevant Pages
|