run time error '1004'

michaelt23

New Member
Joined
Oct 4, 2006
Messages
13
I have a macro someone else created and has since left the company, and when I try to run it I get this, any suggestions?

Run-time error '1004':

PasteSpecial method of range class failed


Here is a copy of the code where it is erroring at.

Selection.PasteSpecial Paste:=xlPasteAllExceptBorders, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False



IF you need more of the code let me know.

Thanks,
Michael
 
Dan,

I replaced my code with yours and I get the same error, so I put the msgbox selection.address in and it shows $A$1 this time.
 
Upvote 0

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
michael

Did you try my suggestion?
 
Upvote 0
michael

Like I said the code needs an overhaul.

Also, did you see my comments regarding selecting/activating?

That's probably at the root of the problem.

PS what code of mine did you try?
 
Upvote 0
Workbooks("ManExcepReport78.xls").Sheets("St 8 No Date").Range("A1").PasteSpecial Paste:=xlPasteAllExceptBorders
 
Upvote 0
It might be the version of Excel that I am using why it worked (2002 SP2), I actually copied the code I replied with, put It in a module and run the code from workbook(ASR78), I did not receive any errors and ended up with a new book called ManExcepReport78.xls.
 
Upvote 0
This is not a version issue, there's nothing in the code that is version specific.

I'm pretty sure the problem is, or is at least connected to, all the activating and selecting.

Also there are a lot of unqualified references in the code.

If you just want to stick with the specific code you might get away with putting this at the start of the code.
Code:
On Error Resume Next
But as far as I'm concerned that's just a quick fix.

But if it works, it works.:)
 
Upvote 0
michael

Glad it worked.:)

But please remember this is only a quick fix, all that does is ignore any errors.
 
Upvote 0

Forum statistics

Threads
1,215,729
Messages
6,126,524
Members
449,316
Latest member
sravya

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top