Error when trying to paste

dgrimm

Board Regular
Joined
Sep 17, 2007
Messages
159
I have the following code:

Sheets(wsRenew).Select
Range("A1:ca10000").Select
Selection.Copy
Workbooks.Add.Activate
ChDir "\\ovpfs1.swissre.com\legacy\corp\hea\apps\STOP LOSS\Renewal Strategy"
ActiveWorkbook.SaveAs Filename:="\\ovpfs1.swissre.com\legacy\corp\hea\apps\STOP LOSS\Renewal Strategy\" & Producer & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Sheets("Sheet1").Select
Range("a1").Select
Selection.Paste

and I have done variations on the paste part (the last line) but I am getting an error everytime. Object not supported or paste method error, etc....it does not like how I am trying to paste for some reason.

Any help would be greatly appreciated.

Thank you in advance

David
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I think that opening a new workbook clears the contents of the clipboard.

Try like this

Code:
Workbooks.Add
ActiveWorkbook.SaveAs Filename:="\\ovpfs1.swissre.com\legacy\corp\hea\apps\STOP LOSS\Renewal Strategy\" & Producer & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ThisWorkbook.Sheets(wsRenew).Range("A1:ca10000").Copy Destination:=ActiveWorkbook.Sheets("Sheet1").Range("a1")
 
Upvote 0
VoG thanks for the help.....the last one errorred me also but I went off of what you said about the clipboard might get erased when opening a new workbook. So I came up with this code and it worked.

Workbooks.Add
ChDir "\\ovpfs1.swissre.com\legacy\corp\hea\apps\STOP LOSS\Renewal Strategy"
ActiveWorkbook.SaveAs Filename:="\\ovpfs1.swissre.com\legacy\corp\hea\apps\STOP LOSS\Renewal Strategy\" & Producer & ".xlsx", FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ThisWorkbook.Sheets(wsRenew).Activate
Range("a1:da100000").Select
Selection.Copy
Windows(Producer & ".xlsx").Activate
Sheets("sheet1").Select
Range("a1").Select
ActiveSheet.Paste

Thanks a bunch

Dave
 
Upvote 0

Forum statistics

Threads
1,224,559
Messages
6,179,513
Members
452,921
Latest member
BBQKING

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