Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automatic location and order of DataLabels? | Charts and Charting in Excel | |||
Eliminate DataLabels upon eachother not readable? | Charts and Charting in Excel | |||
Lock the chart but leave datalabels position editable | Charts and Charting in Excel | |||
How to assign datalabels to a scatter chart, obtaining the labels. | Excel Discussion (Misc queries) | |||
Converting DataLabels to Numbers | Excel Programming |