1004 Excel Cannot Paste Data (Pictures) To Workbook

Frenzyy

New Member
Joined
May 26, 2019
Messages
24
Office Version
  1. 365
Platform
  1. Windows
Hey All,

Would you be so kind please and help me figure out why the below code only works from time to time but more often than not throws the 1004 error?
All I'm trying to do is copy charts without links from one workbook to another.
VBA Code:
Sheets.Add(After:=Sheets(name1)).Name = charts
    wb.Worksheets(charts).Activate
    Cells.Copy
    wb2.Worksheets(charts).Activate
    ActiveSheet.Pictures.Paste.Select

Please kindly note a similar version of this question has also been posted here: Copy Charts to new Workbook and Un-link Chart Data

Many thanks!
 
Last edited by a moderator:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Try adding these 2 lines
Rich (BB code):
    Sheets.Add(After:=Sheets(name1)).Name = charts
wb.Activate
    wb.Worksheets(charts).Activate
    Cells.Copy
wb2.Activate
    wb2.Worksheets(charts).Activate
    ActiveSheet.Pictures.Paste.Select

It helps if you tell us which line your code fails on
wb.Activate is probably unnecessary but will do no harm!
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,974
Messages
6,122,536
Members
449,088
Latest member
RandomExceller01

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