Preserve Excel Chart Formatting When Copying Charts with VBA
Question details
The user needs to preserve chart formatting when copying charts from a SharePoint workbook to a dashboard workbook with VBA.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Copy charts from a SharePoint-hosted workbook into a separate dashboard workbook.
- Observed behavior
- The pasted charts lose their color scheme, axis formatting, and data table formatting.
Open both workbooks in desktop Excel and note their workbook names, worksheet names, and the source chart object's name. Enable macros only if you trust the workbook containing the VBA code.
Copy the complete chart object using explicit workbook references
Use this approach to copy an editable chart and reduce formatting changes caused by copying only its chart area.
Copying the entire ChartObject retains more of the chart's properties than copying only the chart area. The destination workbook's theme or regional settings can still affect the result.
In desktop Excel, open both workbooks, then press Alt+F11. In the VBA editor, choose Insert > Module in a trusted macro-enabled workbook.
Paste this code into the module and replace the workbook, sheet, and chart names with your own: Sub CopyDashboardChart() Dim sourceSheet As Worksheet Dim targetSheet As Worksheet Dim sourceChart As ChartObject Dim pastedChart As ChartObject Set sourceSheet = Workbooks("Source.xlsx").Worksheets("Data") Set targetSheet = Workbooks("Dashboard.xlsx").Worksheets("Dashboard") Set sourceChart = sourceSheet.ChartObjects("Chart 1") sourceChart.Copy targetSheet.Paste Set pastedChart = targetSheet.ChartObjects(targetSheet.ChartObjects.Count) With pastedChart .Left = 20 .Top = 20 .Width = sourceChart.Width .Height = sourceChart.Height End With End Sub
Place the cursor in the macro and press F5. In the dashboard worksheet, check the pasted chart's colors, axes, data table, size, and position.
If colors differ, compare the workbooks' themes under Page Layout > Themes. If axis labels differ, right-click the axis, choose Format Axis > Number, and set the required number format. Applying a workbook theme can also change other dashboard elements.
Right-click the pasted chart and choose Select Data to inspect its source ranges. Keep the SharePoint source accessible if the chart uses external references, or copy the required data into the dashboard and update the ranges.

Paste the chart as a picture to preserve its appearance
Use a picture when visual fidelity matters more than keeping an editable, automatically updating chart.
Work with spreadsheet charts in WPS Office
WPS Office is a free, lightweight Office alternative with a familiar interface for opening and editing compatible spreadsheet files. It can help you migrate everyday workbook tasks, although it does not fix Excel VBA behavior and macro compatibility may vary by version.

Frequently Asked Questions
Why do chart colors change after I paste them into another workbook?
Charts that use theme colors can adopt colors from the destination workbook's theme. Compare the themes under Page Layout > Themes or set the chart elements to specific colors.
How can I find the chart object's name for the macro?
Select the chart and check the Name Box to the left of the formula bar, or use Home > Find & Select > Selection Pane to inspect objects on the worksheet.
Will the copied chart still use data from SharePoint?
It may retain external references to the source workbook. Right-click the chart and choose Select Data to inspect its ranges, and ensure the source remains accessible if those references are needed.
How do I fix axis numbers that look different in the dashboard?
Right-click the axis, choose Format Axis > Number, and select or enter the intended format. Regional settings can affect how separators and dates are displayed.




