Replace for Chart Formulas?

kbrownk

New Member
Joined
Jun 18, 2011
Messages
27
Does anyone know if there's a way to replace letters or numbers in series formulas within charts? Seems obvious but I've had no luck googling.

If an example is needed:

I have 2 series in a scatter plot:
=SERIES(Sheet1!$A$1,Sheet1!$C$1:$M$1,Sheet1!$C$2:$M$2,1)
=SERIES(Sheet1!$A$3,Sheet1!$C$3:$M$3,Sheet1!$C$4:$M$4,1)

I'd like to replace all "C" with "O" and "M" with "Y".

In reality I have 68 series so you can see why I don't want to do this manually!

Thanks,
kbrownk
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
1:Change "Master" with your sheet Name
2: Change "Chart 1" with your Chart Name

Code:
Sub changeaddress()
    With ThisWorkbook.Worksheets("Master")
        With .ChartObjects("Chart 1").Chart
            For i = 1 To .SeriesCollection.Count
               .SeriesCollection(i).Formula = Replace(.SeriesCollection(i).Formula, "$C", "$O")
               .SeriesCollection(i).Formula = Replace(.SeriesCollection(i).Formula, "$M", "$Y")

            Next
        End With
    End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,543
Messages
6,125,423
Members
449,223
Latest member
Narrian

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