View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tushar Mehta[_3_] Tushar Mehta[_3_] is offline
external usenet poster
 
Posts: 37
Default delink all charts in worksheet

While anything's possible it is highly unlikely I wrote that code. The
style is very unlike mine, and the number of selects and activates is
something I haven't done for *at least* a decade.

The below is lightly tested. Run delinkChartsActiveSheet to delink all
charts in the active sheet and DelinkChartsActiveWorkbook to delink all
charts in all sheets in the active workbook.

Option Explicit

Private Sub delinkOneChart(aChart As Chart)
Dim aSeries As Series
'On Error Resume Next
For Each aSeries In aChart.SeriesCollection
With aSeries
.XValues = .XValues
.Values = .Values
.Name = .Name
'a bubble chart has one more element. BubbleSize?
End With
Next aSeries
End Sub
Private Sub delinkChartsOneSheet(aSheet As Object)
Dim ChartObj As ChartObject
If TypeOf aSheet Is Chart Then delinkOneChart aSheet
For Each ChartObj In aSheet.ChartObjects
delinkOneChart ChartObj.Chart
Next ChartObj
End Sub
Public Sub delinkChartsActiveSheet()
delinkChartsOneSheet ActiveSheet
End Sub
Public Sub DelinkChartsActiveWorkbook()
Dim aSheet As Object
For Each aSheet In ActiveWorkbook.Sheets
delinkChartsOneSheet aSheet
Next aSheet
End Sub



In article .com,
says...
I've used a macro written by Tushar Mehta to delink charts in my
worksheet.

I need to delink all worksheets and have tried adding some code to
activate the charts one at a time. It seemed to work fine one time,
but it's now giving me problems. Here is the code. Help me out if
you can.

{snip}