+ Reply to Thread
Results 1 to 2 of 2

Format Data Labels via VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    04-26-2013
    Location
    London
    MS-Off Ver
    Excel 2010
    Posts
    18

    Post Format Data Labels via VBA

    Hi Guys,

    Help please, I am trying to format the data labels that appear on the piechart through vba. As the graph is autocreated via a macro I do not want to have to manually format the graph. I need to change the colour and make bold the data labels.

    The current code is as follows.
     With objChart.Chart
            .ChartArea.AutoScaleFont = False
            .ChartType = xl3DPieExploded
            .SetSourceData Source:=Range("$G$2:$G$106,$R$2:$T$106")
            .HasTitle = True
            .ChartTitle.Characters.Text = "Chart to Show Percentage Cost per Project"
            .ChartTitle.font.Bold = True
            .ChartTitle.font.Size = 12
            .ChartArea.Border.LineStyle = xlDashDot
            .ApplyDataLabels Type:=xlDataLabelsShowLabelAndPercent
            .PlotArea.Select
        ' Set Chart Background '
        With Selection.Interior
        .ColorIndex = 41
        .PatternColorIndex = 1
        .Pattern = xlSolid
                End With
    all and any help will as always be much appreciated.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,481

    Re: Format Data Labels via VBA

            .ApplyDataLabels Type:=xlDataLabelsShowLabelAndPercent
            With .SeriesCollection(1).DataLabels
                .Font.Bold = True
                .Format.Fill.ForeColor.RGB = RGB(255, 0, 0)
            End With
    Does you chart really have +100 slices? and why the additional columns selected for data source?
    Cheers
    Andy
    www.andypope.info

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Format Chart Data Labels Alignment
    By MissaLissa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2013, 04:11 AM
  2. macro to format data Labels
    By subhs82 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2011, 03:50 PM
  3. Macro to format data points and labels
    By ridingbio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-30-2011, 02:07 PM
  4. How do I format the data labels in my stacked bar graph?
    By ocjred in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-02-2006, 11:05 AM
  5. data labels change format
    By john mcmichael in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-16-2006, 12:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1