Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Excel VBA Vs Chart Data Tables

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default Excel VBA Vs Chart Data Tables

Hi,

No VBA will not allow you to extend formatting of the tables.

You may currently being doing okay with static values rather than cell
references but keep in mind there is a limit to the series formula
length, ~1024 characters. With precision numbers it is very easy to
exceed this limit with only a few data points.


Cheers
Andy

Clinton M James wrote:
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



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Excel VBA Vs Chart Data Tables

"... 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" wrote in message
...
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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I create a stacked chart based on 2 tables of data? Accounts Charts and Charting in Excel 0 April 25th 07 07:06 PM
Excel Column Chart with Data Tables [email protected] Charts and Charting in Excel 1 March 9th 07 06:00 PM
Loss of formatting in chart data tables John Richmond, Watford UK Charts and Charting in Excel 2 May 8th 06 09:32 PM
How To: Link worksheet data to pre-existing chart tables Fitz Excel Worksheet Functions 4 October 24th 05 11:05 PM
Chart - Data Tables lajohn63 Charts and Charting in Excel 1 June 8th 05 01:48 PM


All times are GMT +1. The time now is 05:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"