Newbie Question - Paste method error (1 Viewer)

owen_2006

New member
Local time
Today, 13:59
Joined
Oct 10, 2006
Messages
4
Hi Guys,

I have a problem that i have been trying to fix for a while now without much success. I have been trying to do a simple copy and paste from one spreadsheet to another and i keep getting a "Paste method of range class failed" error whenever i test the macro. Can I please trouble anyone out there to have a look at the vba code and provide some insight on where i am going wrong.

Application.Goto _
Workbooks("Master file.XLS").Sheets("Mapping Master Sheet").Range("data")
Selection.Copy
Application.CutCopyMode = False
Workbooks.Open FileName:="I:\Cognos\COA & Rollup\Temp.xls"
Sheets("ALLFRSMPG").Activate
Range("A1").Select
ActiveSheet.Paste

The break is at the last line of code.

Thank you in advance,
O
 

Robert88

Robbie
Local time
Today, 15:59
Joined
Dec 18, 2004
Messages
335
Hi owen_2006

Do you have a sheet Sheets("ALLFRSMPG").Activate
?

Or a Range in the sheet of Range("A1").Select
?

Robert88
 

owen_2006

New member
Local time
Today, 13:59
Joined
Oct 10, 2006
Messages
4
Hi Robert88,

Thanks for replying, Yes I have a sheet in the Temp.xls file called ALLFRSMPG and the top left cell is A1. Do I need to rename this cell and specify the new name range?

Looking forward to your reply,
Kind regards
Owen
 

owen_2006

New member
Local time
Today, 13:59
Joined
Oct 10, 2006
Messages
4
Hi Again Robert88,

Actually the error that comes up is "Paste method of range class failed" so I think that the past command needs to be changed, but I'm not sure.

Any advice is gratefully appreciated.

Thanks again Owen
 

Robert88

Robbie
Local time
Today, 15:59
Joined
Dec 18, 2004
Messages
335
Hi owen_2006,

Have you got a range named "A1" in your Excel?

Robert88
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:59
Joined
Sep 12, 2006
Messages
15,710
i'm not sure about excel macros but is the last statement the problem

does activesheet.paste try to paste the active sheet over itself

shouldn't there be a selection.paste or something else to reference your prior copy.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 06:59
Joined
Sep 12, 2006
Messages
15,710
coincidentally on another thread here, they seem to be doing a copy and then a

selection.insert, do maybe thats the correct syntax!
 

owen_2006

New member
Local time
Today, 13:59
Joined
Oct 10, 2006
Messages
4
Hi gemma-the-husky,

Thanks for the suggestion, which thread was doing a similar discussion....I can't seem to find it.

Thanks,
O
 

Users who are viewing this thread

Top Bottom