Error in Copying Range

  • Thread starter Michael Jurewitz
  • Start date
M

Michael Jurewitz

Has anyone noticed that Excel 2004 for the Mac has problems in VBA in
copying ranges of data? I use the following method to copy a column I
use as a template for formatting and populate it across my sheet for
as many columns as I need:

For mjCounter = 0 To (mjNumContracts - 2)
Range("B:B").Select
Selection.Copy
Range("B:B").Offset(0, 1 + mjCounter).Range("A:A").Select
ActiveSheet.Paste

Next mjCounter

When I go to run the subroutine that uses this method, I get the
following error:

Run-time error '1004'
Copy method of Range class failed.

Is this a known issue? Are there ways to fix it? Thanks for your
help!

-Mike Jurewitz
 
J

Jason Morse

This code works fine for me. Perhaps there is something else earlier in
your code that is causing the problem here?

All I did was paste this code into a new workbook, define the
mjNumContracts = 5, and put some data into column B to be copied. It
ran without error.

-Jason
 
K

Kristina Conceicao

Michael said:
Has anyone noticed that Excel 2004 for the Mac has problems in VBA in
copying ranges of data? I use the following method to copy a column I
use as a template for formatting and populate it across my sheet for
as many columns as I need:

For mjCounter = 0 To (mjNumContracts - 2)
Range("B:B").Select
Selection.Copy
Range("B:B").Offset(0, 1 + mjCounter).Range("A:A").Select
ActiveSheet.Paste

Next mjCounter

When I go to run the subroutine that uses this method, I get the
following error:

Run-time error '1004'
Copy method of Range class failed.

Is this a known issue? Are there ways to fix it? Thanks for your
help!

-Mike Jurewitz

Are you executing this code while a userform is loaded? There is a
known issue with that (you get the error you're seeing). I've had
success when I unload the userform before copying.

Kristina
 

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