LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.misc
Bill Martin
 
Posts: n/a
Default Charting Question

Actually it allows you to do anything you want. Anything you can add manually
to a chart you can record to see how VBA does it. In the SourceDataSeries
section of creating the chart you can fill in a data name. And that does indeed
get recorded into VBA by the macro recorder. Here's what I recorded for a
trivial example with two data lines:

range("A2:C21").Select
Charts.Add
ActiveChart.ChartType = xlXYScatter
ActiveChart.SetSourceData Source:=Sheets("Test").range("A2:C21"), PlotBy:= _
xlColumns
ActiveChart.SeriesCollection(1).Name = "=""First Data Line"""
ActiveChart.SeriesCollection(2).Name = "=""Second Data Line"""
ActiveChart.Location Whe=xlLocationAsObject, Name:="Test"

Alternatively you could put the names of the plot lines in a cell, and just put
the cell address into the Series title box to automatically pull it off the
spreadsheet.

Bill
----------------------------

sfrancoe wrote:
The problem with that is that the chart wizard doesnt give you the ability to
assign a different value to the labels other than x value or y value. Once
the chart is created there is no way that I can see to assign a different
column to be the data labels.

"Bill Martin" wrote:


sfrancoe wrote:

I have a table of data which I create a scatter graph to show the points. Is
there an easy way to add labels through VBA? For eaxample if I have the data
below in a spreadsheet and I want column B to be the X-axis and column C to
be the Y-axis how can I easily/automatically add the text in column A as the
data label? Also, oes it matter what order the data is sorted in? I want to
sort by column A. Thanks

A B C
1 Florida 2.5 500
2 Maine 2.7 300


-------------------------

Have you tried to turn on the macro recorder, create the chart you want with
everything included and formatted then turn off the recorder and look at the VBA
code it created? I'd start from there.

Bill

 
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
Dynamic Charting Question Barb Reinhardt Charts and Charting in Excel 4 January 11th 06 04:53 PM
Pivot table question gary Excel Discussion (Misc queries) 1 January 10th 06 06:25 PM
Hints And Tips For New Posters In The Excel Newsgroups Gary Brown Excel Worksheet Functions 0 April 15th 05 05:47 PM
Simple charting question codetalker Charts and Charting in Excel 1 January 31st 05 04:13 AM
Dynamic charting problems (events) [email protected] Charts and Charting in Excel 4 January 27th 05 09:32 PM


All times are GMT +1. The time now is 07:49 AM.

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"