Willow Solutions, Inc. Leaf graphic
Willow SOlutions, Inc. Software that thinks like you do
News
Products
Case Studies
Tips
Willow Talk
Clients
Partners
Job Openings
Home

Willow Talk

 
 
Back to Willow Talk

Re: Using the name&value data of an excel chart in

Posted By:

Ted Bukowski

Email:

tbukowski@willowsolutions.com

Date:

12/10/2002

Time:

6:15:56 PM

Comments:

When you put the mouse over a point in a series on an Excel chart what is displayed is the value on the x and y axis. For example you may have the date on the x axis and the price on the y axis and this is what is displayed when you hover the mouse over the particular point on the chart.

The way you would access this information programmatically would be to drill down through all the objects in Excel. This is tricky because some of the objects are containers which contain other objects. The object you want to access is called a DataLabel.

If you type DataLabel in the VBA editor then select it and then press F1 you will go to the help section which explains how to call it and provides you an example of some code. The code from the help is:

Worksheets(1).ChartObjects(1).Chart _
.SeriesCollection(1).DataLabels(5).NumberFormat = "0.000"

This code sets the format for the fifth data label in the first series on the chart to have 3 decimal points. If you want to put the data label into a string variable the code would be:

Dim sString as String

With Charts("chart1")
With .SeriesCollection(1).Points(2)
.HasDataLabel = True
sString =.DataLabel.Text
End With
End With

Hope this helps.



Related Messages:

Using the name&value data of an excel chart in VBA
        Re: Using the name&value data of an excel chart in

  What's New | Products | Case Studies | Willow Tips | Willow Talk | Clients | Partners | Job Openings | Home
  Terms of UsePrivacy Statement
Willow Solutions, Inc.85 Willow Street, New Haven CT 06511 USA203.777.5634info@willowsolutions.com