Transfering charts from ne workbook to another

sb1000

New Member
Joined
Aug 12, 2002
Messages
5
When I copy charts along with the data tables on which they are based to another workbook, the charts are still linked back to the original file and not to the new file, even though I have copied the data over on which they are based. Is there a way you can copy over the graphs linked with the data without having to redraw the graphs on the new workbook?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
The following code moves (not copies) selected sheet(s) and any associated charts to a new workbook.

I appreciate that it does not do exactly what you want but it might be a useful starting point.

Sub XPort()
Dim response As Boolean, CopySheets() As String, nSheets As Integer
Dim Wsht As Object
nSheets = 0
For Each Wsht In ActiveWindow.SelectedSheets
If UCase(TypeName(Wsht)) = UCase("Worksheet") Then
Call LinkList(Wsht.Name, CopySheets, nSheets)
nSheets = nSheets + 1
ReDim Preserve CopySheets(1 To nSheets)
CopySheets(nSheets) = Wsht.Name
End If
Next Wsht
Sheets(CopySheets).Copy
response = Application.Dialogs(xlDialogSaveAs).Show
Application.DisplayAlerts = False
ActiveWorkbook.Close
If Not response Then
MsgBox prompt:="Operation cancelled", Title:="Move sheets", _
Buttons:=vbOKOnly + vbExclamation
Exit Sub
End If
Sheets(CopySheets).Delete
Application.DisplayAlerts = True
Worksheets(Worksheets.Count).Select
End Sub
Sub LinkList(Search As String, GList() As String, nFound As Integer)
Dim Graph As Object
Dim Lnk As String
Dim iSeries As Integer, nSeries As Integer
Dim Flagged As Boolean
For Each Graph In Charts
Flagged = False
nSeries = Graph.SeriesCollection.Count
For iSeries = 1 To nSeries
On Error Resume Next
Lnk = Graph.SeriesCollection(iSeries).Formula
On Error GoTo 0
If Not Flagged And (InStr(UCase(Lnk), UCase(Search & "!")) > 0 _
Or InStr(UCase(Lnk), UCase("'" & Search & "'!")) > 0) Then
Flagged = True
nFound = nFound + 1
ReDim Preserve GList(1 To nFound)
GList(nFound) = Graph.Name
End If
Next iSeries
Next Graph
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,509
Members
449,089
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