View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
George Rickerson[_2_] George Rickerson[_2_] is offline
external usenet poster
 
Posts: 1
Default Find range for plotarea

Hi, Jon -
Thanks for your response. Actually, I think I may have found an indirect
way to find the range, I'd be interested in your assessment of this idea. If
I name the range, then I think I can use the RefersTo property of the Names
object to get the range specification in A1 format (as a string). Then I can
extract the numeric part of the lower right corner of the range, change it to
a number, increment it by the number of rows I have added, change it back to
a string, rebuild the range spec and redefine the range name to refer to the
new range. The part I haven't solved yet is getting the chart then to be
graphing based on the new range.

This is just one little part of a much larger program that is presenting
me with much more challenging issues, so it may be a while before I am able
to test this idea.

thanks,
George.

"Jon Peltier" wrote:

The 'data range' is not exposed in any way to VBA. You could use John
Walkenbach's series formula class module

http://www.j-walk.com/ss/excel/tips/tip83.htm

to determine the range of X values and all the ranges of Y values, and use
Union to determine the combined range. Keep in mind that this data range is
often stated by Excel as being too complex: all you need is one series with
a different number of points, or the series plot order rearranged, or two
different sets of X values used in the chart.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"George Rickerson" <George wrote in
message ...
Hi -
I hate to take up people's time with such a simple problem, but I have
looked for the answer everywhere I can think of and have come up dry. So
thanks for your help in advance.

I need to find the data range for a chart. My goal is to change the data
range to include new data I have added to the worksheet. The number of
rows
of new data may be different each time I run this macro, and, of course,
the
data range for the chart will be different every time I run the macro,
since
I will have changed it previously.

I have scoured the plotarea and chart objects as well as the range object
and can't figure it out. I have recorded a macro in which I select the
plotarea and then use right click to get to the dialog box that specifies
the
data range, but the VB resulting from this recording doesn't include
anything
other than making the chart object active.

thanks
George.