ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating the X and Y Values (https://www.excelbanter.com/excel-programming/289504-updating-x-y-values.html)

Alex A.

Updating the X and Y Values
 
Hello, I need to update the X axis labels and Y Values
dynamically. In other words as the spreadsheet changes
my graph will update the X axis and Y axis values. The
Columns don't change so I just use numbers but the Rows
do change so I am trying to use a variable. My two
variables are x1 and x1. I tried the code below but to
no avail. I tried with and without parenthesis. Help!


'Update Graph1
Sheets("Chart2").Select
ActiveChart.SeriesCollection(1).XValues = "=Query!
Rx1C1:Rx2C1"
ActiveChart.SeriesCollection(1).Values = "=Query!
Rx1C5:Rx2C5"

'Update Graph1
Sheets("Chart2").Select
ActiveChart.SeriesCollection(1).XValues = "=Query!R(x1)
C1:R(x2)C1"
ActiveChart.SeriesCollection(1).Values = "=Query!R(x1)C5:R
(x2)C5"


No Name

Updating the X and Y Values
 

I meant that my two variables are x1 and x2. I just
tried it with

ActiveChart.SeriesCollection(1).XValues = "=Query!
$A$x1:$A$x2"
ActiveChart.SeriesCollection(1).Values = "=Query!
$E$x1:$E$x2"

and it still doesn't work.
AA

Jon Peltier[_6_]

Updating the X and Y Values
 
Check out the response in the charting group.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
http://PeltierTech.com/Excel/Charts/
_______

wrote:

I meant that my two variables are x1 and x2. I just
tried it with

ActiveChart.SeriesCollection(1).XValues = "=Query!
$A$x1:$A$x2"
ActiveChart.SeriesCollection(1).Values = "=Query!
$E$x1:$E$x2"

and it still doesn't work.
AA




All times are GMT +1. The time now is 09:38 PM.

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