Need to remove quotes when setting dynamic chart series from macro

vermontdude

New Member
Joined
Jan 27, 2011
Messages
1
I'm trying to dynmically change a chart series. I can do it manually fine however, when I try and run an update macro to change the name there are extra quotation marks that get added and the dynamic bit fails.
Hope this is easy ... Thanks

========================================
I have a range 'GZ01Values' that I define manually as
=OFFSET(ChartData!$B$31,1,0,COUNT(ChartData!$B:$B),1)
however when the macro below runs this is what if get:
="OFFSET(ChartData!$B$31,1,0,COUNT(ChartData!$B:$B),1)"
The quotes mess it up.

Here's my macro:

<CODE style="COLOR: #000">Sub newSeriesName() </CODE>
<CODE style="COLOR: #000">' </CODE>
<CODE style="COLOR: #000">Dim newName As Variant </CODE>
<CODE style="COLOR: #000">' </CODE>
<CODE> </CODE><CODE style="COLOR: #000">newName = Sheets("ChartDates").Range("D7") </CODE>
<CODE> </CODE>
<CODE> </CODE><CODE style="COLOR: #000">' Below is the string in the ChartDates!(D7) Cell </CODE>
<CODE> </CODE><CODE style="COLOR: #000">' "OFFSET(ChartData!$B$31,1,0,COUNT(ChartData!$B:$B),1)" </CODE>
<CODE> </CODE>
<CODE> </CODE><CODE style="COLOR: #000">ActiveWorkbook.Names.Add Name:="GZ01Values", RefersToR1C1:= _ </CODE>
<CODE> </CODE><CODE style="COLOR: #000">newName </CODE>
<CODE> </CODE>
<CODE style="COLOR: #000">End Sub</CODE>
 

Forum statistics

Threads
1,226,883
Messages
6,193,492
Members
453,803
Latest member
hbvba

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