Chart & Visualization Issues

Preserve Excel Chart Formatting When Copying Charts with VBA

Olivia MillerOlivia Miller Dec 2, 2026 868 views

Question details

The user needs to preserve chart formatting when copying charts from a SharePoint workbook to a dashboard workbook with VBA.

Preserve Excel Chart Formatting When Copying Charts 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.
Before you start

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.

Solution 1Recommended

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.

1
Open the VBA editor

In desktop Excel, open both workbooks, then press Alt+F11. In the VBA editor, choose Insert > Module in a trusted macro-enabled workbook.

2
Add the copy macro

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

3
Run and inspect the chart

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.

4
Check themes and number formats

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.

5
Verify the chart data

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.

Copy the complete chart object using explicit workbook references
Formatting may depend on the destination: Theme colors and regional number settings can change the chart's appearance. Reapply specific axis or data table formats in the dashboard if needed.
Free Microsoft Office alternative

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.

View and edit spreadsheet charts in a familiar interfaceOpen and save common Microsoft Excel formats, including XLSXMove everyday spreadsheet work to a lightweight Office suiteUse free tools for common workbook and dashboard tasks
microsoft office alternative - wps office

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.