Dim x As Integer
ActiveChart.SeriesCollection(1).XValues = "=Data!R3C3:R3C" & x
ActiveChart.SeriesCollection(1).Values = "=Data!R19C3:R19C" & x
x = x + 1
Let x = 3
The macro setx is just to give the variable x an initial value. it could be set from a cell value.
As you have already discovered, a BYTE can contain 256 values (0 to 255), and an INTEGER consists of 2 BYTES.
So, an INTEGER can contain 256*256=65536 WHOLE NUMBER values.
If you do not assign the variable type Excel automatically assigns the VARIANT type.
I would just say that defining your variables as certain types is just good practice.
Others may want to step in with their own points of view.
Maybe this topic is not the place for this discussion and another could be created.
Back to the charts....
Excel will need to know the starting point, that is, the date that the first column number.
From there a simple formula could be constructed to determine the current month value.
Starting Month=Jan 2010
Current Month=April 2011
Current Month-Starting Month=difference in months = 15
I'm using excel 2003.
When I ran the code:
- My graphline vanished, only trendline is still there.
- The x-axis text vanished except for "jan 2009".
- No error messages were shown.
Running the code multiple times didn't make any difference.
I know your 3 was just an example, as was my 26 times.
To change the initial value in a cell means I have to calculate which number to input according to the months I want to show. That is not preferable since I might not use the file for a month to built up data and I might be out of it and besides that it should be easy to use for other users as well.