Updating the X and Y Values

A

Alex A.

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

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top