LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Select different data label range (as values)

Hello All:

Below is the code from Microsoft to apply category labels to an XY data
series.
I've changed the SeriesCollection and Offset values to fit my chart and it
works fine.
However, the data labels are text labels and I really need them to be values
that can be formatted like any other number value.
Is there any way to modify this code to create the new data labels as values
instead of text?

I've been fooling around with 'DataLabel.Text' in the second to last line to
no avail...

Thanks.

Mike

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(8).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(8).Points(Counter).Ha sDataLabel = True
ActiveChart.SeriesCollection(8).Points(Counter).Da taLabel.Text =
Range(xVals).Cells(Counter, 1).Offset(0, -9).Value
Next Counter

End Sub
 
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
Missing Data Label on XY Values [email protected] Excel Worksheet Functions 1 April 2nd 08 04:49 PM
How to select a range based on values in 1 column ForestRamsey Excel Programming 2 August 30th 05 05:00 PM
Select range -- convert formulas to values Johnny[_9_] Excel Programming 3 June 21st 05 03:40 PM
using cell values to select range of cells Ray[_9_] Excel Programming 4 October 10th 03 08:31 AM
How to select range of values in pivot table? RADO Excel Programming 1 October 9th 03 09:00 AM


All times are GMT +1. The time now is 06:20 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"