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>
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>