VBA bug in Excel 2004?

C

c1802362

Hello, everyone!

I have a strange problem on my Mac that has never materialized before.
I wrote some VBA code at work (PC running Win XP). I brought the code
home to my Mac (iMac G5, Excel 2004 (v11.0), VBA v11.0) and it
immediately bombed. What is strange is that the code which is blowing
up ' Selection.Copy' (returns a run-time error '1004' "copy method of
range class failed"), is pretty generic, so I reinserted the code using
the record macro function figuring maybe something was embedded in the
line that I couldn't see. No luck.

So I tried recording a generic macro on the Mac which copies some cells
then pastes them into another area of the worksheet. The code reads
identically to what was on the PC, but any attempt to run the macro
results in the same run-time error.

So, the question is: a) why won't a VBA command as basic as copy work?
and b) why won't a macro recorded in the native environment run
afterwards? It seems to me to be a software issue. Does Microsoft have
a patch?

Art
 
J

JE McGimpsey

c1802362 said:
I have a strange problem on my Mac that has never materialized before.
I wrote some VBA code at work (PC running Win XP). I brought the code
home to my Mac (iMac G5, Excel 2004 (v11.0), VBA v11.0) and it
immediately bombed. What is strange is that the code which is blowing
up ' Selection.Copy' (returns a run-time error '1004' "copy method of
range class failed"), is pretty generic, so I reinserted the code using
the record macro function figuring maybe something was embedded in the
line that I couldn't see. No luck.

So I tried recording a generic macro on the Mac which copies some cells
then pastes them into another area of the worksheet. The code reads
identically to what was on the PC, but any attempt to run the macro
results in the same run-time error.

So, the question is: a) why won't a VBA command as basic as copy work?
and b) why won't a macro recorded in the native environment run
afterwards? It seems to me to be a software issue. Does Microsoft have
a patch?

You haven't really described the problem specifically enough to identify
a problem, much less what might be "patched".

If you're really running XL 2004 (v11.0) then your version is *years*
out of date, and you need to update Office, either via Microsoft
AutoUpdate or downloading from MacTopia. The current version is XL 2004
(v11.3.3) and VBA (11.2).

If you're actually running an updated copy, post the code you're using
in a reply, along with the specifics of what is selected. This works
fine for me, whether a range or a shape is selected:

Selection.Copy
Range("Z200").Select
ActiveSheet.Paste
 
C

c1802362

I updated the software and the macros now work. Thanks!

The only issue now to resolve is that the code I wrote takes about 75
seconds to execute on the PC, while the mac run takes over 15 minutes
(yes I timed it). The file is a large database (5000+ lines)

So, how do I increase the execution speed on the Mac?

Particulars: iMac G5/1.8GHz/1 GB RAM PC/OS 10.3.9 is a Dell
610/1.73GHz/512 KB RAM/Windows XP

Art
 
J

JE McGimpsey

c1802362 said:
The only issue now to resolve is that the code I wrote takes about 75
seconds to execute on the PC, while the mac run takes over 15 minutes
(yes I timed it). The file is a large database (5000+ lines)

So, how do I increase the execution speed on the Mac?

Hard to say without knowing what your code is doing.

So a couple of general suggestions:

If you're manipulating the worksheet, make sure that you've set

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

(reset .Calculation to xlCalculationAutomatic before your macro exits).

Work with range objects directly rather than the Selection object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top