ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need help Utilizing Dynamic ranges for creating charts (https://www.excelbanter.com/excel-programming/376579-need-help-utilizing-dynamic-ranges-creating-charts.html)

havocdragon

Need help Utilizing Dynamic ranges for creating charts
 
Here is my situation. I have to create several charts based on data that may
or may not exist in certain forms. I can program for those variables if I
wasnt using a chart...however my boss wants a chart!!

My specific issue is this:

I can't for the life of me, figure out how to get the values in a chart to
accept anything other than the "Sheet1!R2C1,Sheet1!R2C2" etc etc.

how do I get

"Activechart.SeriesCollection(1).Values = "

to work with dynamic ranges?


Jim Thomlinson

Need help Utilizing Dynamic ranges for creating charts
 
You need to build the string to pass in something like this...

dim MyAddress as String

With Range("MyDynaRange")
MyAddress = .Parent.Name & "!" & .Address
End With

Activechart.SeriesCollection(1).Values = MyAddress
--
HTH...

Jim Thomlinson


"havocdragon" wrote:

Here is my situation. I have to create several charts based on data that may
or may not exist in certain forms. I can program for those variables if I
wasnt using a chart...however my boss wants a chart!!

My specific issue is this:

I can't for the life of me, figure out how to get the values in a chart to
accept anything other than the "Sheet1!R2C1,Sheet1!R2C2" etc etc.

how do I get

"Activechart.SeriesCollection(1).Values = "

to work with dynamic ranges?


Toby Erkson

Need help Utilizing Dynamic ranges for creating charts
 
Here's a snippit of code I'm currently using where an existing chart needs
to by updated but the number of series can vary:
-----
Sheets(sheet_name_goes_here).ChartObjects(1).Activ ate
'Set chart's data source
With ActiveChart
.ChartArea.Select
.SetSourceData Source:=Range("Chart_Source_Data"), PlotBy:=xlRows
'Point source to named range
End With
-----
My named range, "Chart_Source_Data", is a dynamic range. Here's a sample of
my range:

........Month..................Jan......Feb.....Ma r
Page Views.............7693....3651...8443
Visits.........................7443....8338...8878

When the dynamic range is dropped into the chart, the Months are the x-axis
and the numbers are the y-axis with the names (Page Views, Visits) the
series name.
--
Toby Erkson
http://www.bidata.net/

"havocdragon" wrote in message
...
Here is my situation. I have to create several charts based on data that
may
or may not exist in certain forms. I can program for those variables if I
wasnt using a chart...however my boss wants a chart!!

My specific issue is this:

I can't for the life of me, figure out how to get the values in a chart to
accept anything other than the "Sheet1!R2C1,Sheet1!R2C2" etc etc.

how do I get

"Activechart.SeriesCollection(1).Values = "

to work with dynamic ranges?





All times are GMT +1. The time now is 03:12 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com