Re: Excel VBA Vs Chart Data Tables

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"... it is cleaner ..."

It does seem that way, doesn't it? You're not cluttering up a worksheet with
data.

Let me give you a counterpoint or two:

* Excel was designed so that charts use data in worksheets, and while there
is the alternative of generating an array of values, the chart is more
efficient using cells.

* As Andy points out, there is a limit to the length of a SERIES formula,
1024 characters. More important, there is a limit to how many characters can
be assigned to X and Y value arrays. This limit is around 250 characters.
This means that some of the 1024 characters are really not usable in the
SERIES formula, because the Plot Order argument is never more than 3
characters (maximum 255 series in a chart), and the Series Name argument is
also usually much less than 250 characters.

* It's easier to understand what is happening in your code if you place the
data into cells.

* As you've discovered, the only way to affect the format of the chart's
data table is to format the cells containing the data.

* Worksheet space is cheap. What's a new hard drive cost, under $1/GB these
days, isn't it? How about RAM? Your time spent working around the benefits
of using a worksheet (which can be hidden from prying eyes, though it's easy
enough to extract data from a chart) is much more expensive.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services, Inc.
http://PeltierTech.com/WordPress/
_______


"Clinton M James" <notrealaddress@xxxxxxxxx> wrote in message
news:uP8O6uZbJHA.556@xxxxxxxxxxxxxxxxxxxxxxx
Hi All,

I am programmatically creating a chart and I believe it is cleaner to do
it by having vba throw values into the chart rather than throw the values
into cells for the chart to read off.

I have no probem creating the chart and having it display as required but
I am meeting with frustration with the associated data table.

I format he numbers of the graph to be a percentage through:

ActiveChart.Axes(xlValue).TickLabels.NumberFormat = "0.00%"

This is fine but this does not transfer to the data table. The table will
display the values in their decimal form instead. Is there a way to fix
this?

Also is there a way to label the data table columns? Without referencing
cells. I know when creating the series it only lets me title the values
through a cell range, can i manually add the series titles through vba
instead?

eg

my data table depics 1 2 3 4 as the titles but I want to change these to
meaningful names.

Apart from this nuisance vba has done well for creating a graph without
direct reference to cells for the values.

Help is appreciated and I thank any helps in advance.

Regards,,
Clint




.



Relevant Pages

  • RE: Remove Space on Bar Charts for Missing Data
    ... launched / select the Exising Worksheet Location radio button / clicked in ... I did a small amount of cosmetic work here centreing the cells in the Pivot ... Dragged chart down to lower right hand side of screen and saved file. ... huge gap for the empty cells in the table it is linked to. ...
    (microsoft.public.excel.charting)
  • Re: Chart Y-axis definition. Limitation for Maximum characters ?
    ... and plot order) are only allotted something less than 256 characters (a ... to the scattered cells in the worksheet. ... > the worksheet was also coming in the chart defining range. ... > data points it wasnt specifying those 8 properly. ...
    (microsoft.public.excel.misc)
  • Sorting imported text
    ... I was able to get my data into a worksheet in a way ... I now have a column of cells, each of which has three characters at the ... I tried to sort the data on ...
    (microsoft.public.excel)
  • Re: Avoid plotting refferanced blanks as zeros in scatter plot gra
    ... all linked back to the original data. ... The chart one shows the ... Chart tab> 'Plot Empty Cells As' will have no effect. ... I have a worksheet that links to tables with data orginized ...
    (microsoft.public.excel.charting)
  • Re: Chart Y-axis definition. Limitation for Maximum characters ?
    ... worksheet I create 20 contiguous cells which are respectively linked to 20 ... > The workaround is to set aside a contiguous worksheet range that links ... >> the worksheet was also coming in the chart defining range. ...
    (microsoft.public.excel.misc)