ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   range variables for chart x axis values (https://www.excelbanter.com/excel-programming/345912-range-variables-chart-x-axis-values.html)

gvm

range variables for chart x axis values
 
Another question related to my recent post. Some search hits come close to a
solution but don't quite hit the spot. I am altering recorded macros. The
line I want to change is:
ActiveChart.SeriesCollection(1).XValues = "='Traffic model'!R14C7:R32C7"

I want to change !R14C7:R32C7 to a form where each row and column number is
a variable.
TIA again ... Greg

bpeltzer

range variables for chart x axis values
 
Just compose the string in the format you've already got, using the &
operator to piece together the various components, along the lines of:
ActiveChart.SeriesCollection(1).XValues = "='Traffic model'!R" & StartRow &
"C" & StartCol & ":R" & EndRow & "C" & EndCol

"gvm" wrote:

Another question related to my recent post. Some search hits come close to a
solution but don't quite hit the spot. I am altering recorded macros. The
line I want to change is:
ActiveChart.SeriesCollection(1).XValues = "='Traffic model'!R14C7:R32C7"

I want to change !R14C7:R32C7 to a form where each row and column number is
a variable.
TIA again ... Greg


Jon Peltier[_10_]

range variables for chart x axis values
 
If you have the range defined already, you can also use this:

ActiveChart.SeriesCollection(1).XValues =
Worksheets("Sheet1").Range("D11:D15")

or this, if rXValues is a VBA range variable:

ActiveChart.SeriesCollection(1).XValues = rXValues

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______


"bpeltzer" wrote in message
...
Just compose the string in the format you've already got, using the &
operator to piece together the various components, along the lines of:
ActiveChart.SeriesCollection(1).XValues = "='Traffic model'!R" & StartRow
&
"C" & StartCol & ":R" & EndRow & "C" & EndCol

"gvm" wrote:

Another question related to my recent post. Some search hits come close
to a
solution but don't quite hit the spot. I am altering recorded macros. The
line I want to change is:
ActiveChart.SeriesCollection(1).XValues = "='Traffic model'!R14C7:R32C7"

I want to change !R14C7:R32C7 to a form where each row and column number
is
a variable.
TIA again ... Greg





All times are GMT +1. The time now is 05:09 AM.

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