Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Missing Data Label on XY Values | Excel Worksheet Functions | |||
How to select a range based on values in 1 column | Excel Programming | |||
Select range -- convert formulas to values | Excel Programming | |||
using cell values to select range of cells | Excel Programming | |||
How to select range of values in pivot table? | Excel Programming |