Newbie Question - Paste method error

owen_2006

New member
Local time
Tomorrow, 07:43
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
 
Hi owen_2006

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

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

Robert88
 
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
 
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
 
Hi owen_2006,

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

Robert88
 
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.
 
coincidentally on another thread here, they seem to be doing a copy and then a

selection.insert, do maybe thats the correct syntax!
 
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

Back
Top Bottom