Copy/Paste Chart Macro not working

rob51852

Board Regular
Joined
Jun 27, 2016
Messages
190
Office Version
  1. 2016
Platform
  1. Windows
Hi,

I'm trying to copy and paste a chart by adding the code to my macro. The first option I tried worked but the chart was poor quality when pasted. I thought this would work but I keep getting an error.

Can anyone see what the issue is?

Thanks

VBA Code:
   With ThisWorkbook.Worksheets("Summary").ChartObjects("OverallAverage").Chart.CopyPicture Appearance:=xlScreen, format:=xlPicture
      ws.Range("Q2").PasteSpecial
   End With

VBA Code:
Sub CreateNewSheet()
   Dim ws As Worksheet
   Application.ScreenUpdating = False
   Application.Calculation = xlManual
   Set ws = Workbooks("Book1.xlsx").Worksheets.Add(After:=Workbooks("Book1.xlsx").Worksheets(Workbooks("Book1.xlsx").Worksheets.Count))
   ws.Name = ThisWorkbook.Worksheets("Summary").Range("E3").Value
    
   With ThisWorkbook.Worksheets("Summary").Range("A71:N221").Copy
      ws.Range("A1").PasteSpecial Paste:=xlPasteValues
      ws.Range("A1").PasteSpecial Paste:=xlPasteFormats
      ws.Range("A1").PasteSpecial Paste:=xlPasteColumnWidths
      ws.Range("A:N").Font.Size = 10
   End With
   
   With ThisWorkbook.Worksheets("Summary").ChartObjects("OverallAverage").Chart.CopyPicture Appearance:=xlScreen, format:=xlPicture
      ws.Range("Q2").PasteSpecial
   End With

   Application.Calculation = xlAutomatic
   Application.ScreenUpdating = True
End Sub
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.

Forum statistics

Threads
1,214,591
Messages
6,120,425
Members
448,961
Latest member
nzskater

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