Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Manipulate Labels on an Excel 3-D Pie Chart

Status
Not open for further replies.

YerMom

Programmer
Oct 3, 2006
127
US
I have a 3-D pie chart and I would like to use VBA to manipulate the labels for the data points. Currently for my chart I have semi colon selected as the separator, but I don't like the look and feel of this or any of the built-in separators. Currently, one of my labels looks like this:

Complete; 133; 61%

Is it possible to parse the label data and format it myself? For example, I would like the label to look like this:

Complete: 133 (61%)

Is it possible to do this?

Thanks.

 


Hi,

Give this a try...
Code:
Sub test()
    Dim ser As Series, pt As Point, a
    For Each ser In ActiveSheet.ChartObjects(1).Chart.SeriesCollection
        For Each pt In ser.Points
            With pt.DataLabel
                a = Split(.Caption, ";")
                .Caption = a(0) & ";" & a(1) & " (" & Trim(a(2)) & ")"
            End With
        Next
    Next
End Sub


Skip,

[glasses] [red][/red]
[tongue]
 
Here's a non-VBA solution...

a) Concatenate the info. For example, with Category name in A1, number in B1, and percent in C1, use the following formula in D1 - and copy down for other data.

=A1&": "&B1&" ("&TEXT(C1,"0%")&")"

b) For the Data Labels, only use "Category name".

c) Under Source Data - Series - Category Labels, reference the labels in column D.

I hope this proves useful. Please advise.

Regards, Dale Watson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top