Modify chart code

vane0326

Well-known Member
Joined
Aug 29, 2004
Messages
819
This code below will convert your chart values into array vaules. How can it be modified so the code could go through every worksheet in the workbook and covert into array values?


Code:
Sub Convert_Into_Array_Values() 
    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


I know it has something to do with in these lines but I can't get it to work.

Code:
   For Each shtTemp In ThisWorkbook.Worksheets 
        For Each chtTemp In shtTemp.ChartObjects
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,136,712
Messages
5,677,335
Members
419,688
Latest member
sarahmichelle

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
Top