How do you isolate a graph from it's data?

M

mizterbusy

Hi everyone,

I have a very large file with lots of data and one sheet full of
graphs.

I need to distribute the graphs but not the data and what I've been
doing is right-clicking the sheet with graphs and selecting

move or copy THEN
create new book THEN
new book

to create a book with the one sheet of graphs. I've then emailed this
sheet out.

My problem now is that when I try this technique, my graphs all get
distorted for some reason.

Can anyone advise me what the best way to do this is - ie. how do you
best quarantine graphs from their data simply and easily, without
distorting the graphs?

Any help would be much appreciated.

Thanks all.
 
C

Carim

Hi,

Following macro does the job ...

Sub DelinkChartFromData()
''' Thanks to Tushar Mehta
Dim mySeries As Series
Dim sChtName As String

''' Make sure a chart is selected
On Error Resume Next
sChtName = ActiveChart.Name
If Err.Number <> 0 Then
MsgBox "This functionality is available only for charts " _
& "or chart objects"
Exit Sub
End If
If TypeName(Selection) = "ChartObject" Then
ActiveSheet.ChartObjects(Selection.Name).Activate
End If
On Error GoTo 0

''' Loop through all series in active chart
For Each mySeries In ActiveChart.SeriesCollection
'''' Convert X and Y Values to arrays of values
mySeries.XValues = mySeries.XValues
mySeries.Values = mySeries.Values
mySeries.Name = mySeries.Name
Next mySeries
End Sub


HTH
Cheers
Carim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top