Dynamic series in Chart

G

Guest

Guys,
I have a spreadsheet with timestamps on col A, then Col B contains the
values correspond to timestamps in ColA (Col C thru Col M are similar to Col
B as well). I am trying to build a chart in function of time (meaning
Values for the X axis would be B2..M2, and Y axis would be B3..M3 for the 1
series, then B3..M3 for the values in x-axis, and B4..M4 for Y axis, so
on...).
Number of rows is subject to change (time stamp entries), and I am only
interested for the last 21 entries (if there is less than 21 entries, plot
them all, otherwise, only plot the last 21 entries). For Instance, if there
are 23 rows of data, the 1st series would be data on row3 Col B to Col M; the
2nd series would be from Row4 ColB to Col M.. the 21st series would be from
Row 23 ColB Col M. If there are less that 21 rows, say, 5. Then 1st series
would be Row1 ColB to Col M; 2nd series would be Row2 ColB to ColM... 5th
series = Row5 ColB..ColM.
Can someone please help me with the equation (offset?) in name definition?

Thanks
Jeff
 
R

R.VENKATARAMAN

use something like these stataements

Dim lastrow As Range
Dim myrange As Range
Set lastrow = Range("a60000").End(xlUp)
Set myrange = Range(lastrow, lastrow.Offset(-20, 0))
MsgBox myrange.Address

you will get last 21 rows in column A
 
T

Tushar Mehta

I'm not sure I understand what you want to do and the examples in the
two paragraphs do not appear to be consistent.

In the first para, it appears that the x-values of a particular series
are the same as the y-values of the previous series. Is that correct?
And, in any case it appears that the first series x-values are in row
2.

However, in para 2, with only 5 rows of data you refer to row 1 as the
source for the first series. Where are the x-values?

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

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