Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Dynamic Charting Question | Charts and Charting in Excel | |||
Pivot table question | Excel Discussion (Misc queries) | |||
Hints And Tips For New Posters In The Excel Newsgroups | Excel Worksheet Functions | |||
Simple charting question | Charts and Charting in Excel | |||
Dynamic charting problems (events) | Charts and Charting in Excel |