Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Datalabels on Scatter

I have 100 names of people in column A, with age in column
B and weight in Column C, and I've made a scatter graph
from this data, without any datalabels.

If a single datapoint is highlighted, I want a macro that
adds the relevant perons's name for that datapoint.

(Or, and I guess this is not possible, can that person's
name show up in the yellow tooltip as the mouse runs over
the label?)

Thanks in advance for any help.

Daniel


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Datalabels on Scatter

Daniel,

Assuming that your data labels are 1 column immediately to
the LEFT of your existing values, the following code will
work for you.

Good luck,
Walt

Sub AttachLabelsToPoints()

'Dimension variables.
Dim Counter As Integer, ChartName As String, xVals As
String

' Disable screen updating while the subroutine is run.
Application.ScreenUpdating = False

'Store the formula for the first series in "xVals".
xVals = ActiveChart.SeriesCollection(1).Formula

'Extract the range for the data from xVals.
xVals = Mid(xVals, InStr(InStr(xVals, ","), xVals, _
Mid(Left(xVals, InStr(xVals, "!") - 1), 9)))
xVals = Left(xVals, InStr(InStr(xVals, "!"),
xVals, ",") - 1)
Do While Left(xVals, 1) = ","
xVals = Mid(xVals, 2)
Loop

'Attach a label to each data point in the chart.
For Counter = 1 To Range(xVals).Cells.Count
ActiveChart.SeriesCollection(1).Points
(Counter).HasDataLabel = _
True
ActiveChart.SeriesCollection(1).Points
(Counter).DataLabel.Text = _
Range(xVals).Cells(Counter, 1).Offset(0, -1).Value
Next Counter

End Sub

-----Original Message-----
I have 100 names of people in column A, with age in

column
B and weight in Column C, and I've made a scatter graph
from this data, without any datalabels.

If a single datapoint is highlighted, I want a macro that
adds the relevant perons's name for that datapoint.

(Or, and I guess this is not possible, can that person's
name show up in the yellow tooltip as the mouse runs over
the label?)

Thanks in advance for any help.

Daniel


.

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
Automatic location and order of DataLabels? tskogstrom Charts and Charting in Excel 1 November 11th 06 08:53 PM
Eliminate DataLabels upon eachother not readable? Marie J-son Charts and Charting in Excel 0 March 1st 06 05:37 AM
Lock the chart but leave datalabels position editable Joy Charts and Charting in Excel 1 June 13th 05 08:21 PM
How to assign datalabels to a scatter chart, obtaining the labels. Jos Koot Excel Discussion (Misc queries) 1 April 22nd 05 12:11 PM
Converting DataLabels to Numbers Dan Gesshel Excel Programming 1 August 1st 03 04:34 AM


All times are GMT +1. The time now is 04:02 AM.

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

About Us

"It's about Microsoft Excel"