ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Dynamic input for Chart gives error9 but seems to do his job to... (https://www.excelbanter.com/excel-programming/279876-dynamic-input-chart-gives-error9-but-seems-do-his-job.html)

the dude

Dynamic input for Chart gives error9 but seems to do his job to...
 
I am currently also making such a macro. I place a cel with a number of
datalines that hold X-values.

I made a macro and am trying to changing the range of the X-axis.

I can't seem to use a variable in the command.

This is the commmand:

ActiveChart.SetSourceData Source:=Sheets("1").Range("A2:B" & bereik + 2),
PlotBy:= _

xlColumns

** ActiveChart.SeriesCollection(1).XValues = _

Worksheets("Blad1").Range("A3:A" & bereik + 2)

ActiveChart.SeriesCollection(1).Values = _

Worksheets("Blad1").Range("B3:B" & bereik + 2)

It creates an error 9 at **. But i do get a graph containing the wright
values.

so it seems to work and fail at the same time.

Do you have an idea of what my problem could be?

THX




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

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