Coloring Data Label

samahiji

Board Regular
Joined
Oct 6, 2015
Messages
67
Office Version
  1. 2019
Platform
  1. Windows
Hi
The following code was written to color a data label. everything is fine, but when file is saved and then reopened, all data label including the empty labels are colored as well, which creats an ugly chart!

Please help :(

Code:
                     With .SeriesCollection.NewSeries
                    .Name = "=" & COM.Name & "!R10C4"
                    .Values = "=" & COM.Name & "!R" & 12 & "C2:R" & COM.Cells(1, 1).Value & "C2"
                    .XValues = "=" & COM.Name & "!R" & 12 & "C1:R" & COM.Cells(1, 1).Value & "C1"
                      .Border.Color = RGB(0, 102, 204)
                      .Format.Line.Weight = 0.1
                      .Format.Line.DashStyle = msoLineSysDot
                    
                    End With
    
    
    .SeriesCollection("WSM").Select
    .SeriesCollection("WSM").ApplyDataLabels
    .SeriesCollection("WSM").DataLabels.Select
    .SeriesCollection("WSM").DataLabels.Select
    .SeriesCollection("WSM").DataLabels.Format.TextFrame2.TextRange. _
        InsertChartField msoChartFieldRange, _
        "=" & COM.Name & "!R" & 12 & "C" & (Currcol + 2) & ":R" & COM.Cells(1, 1).Value & "C" & (Currcol + 2) _
        , 0
    Selection.ShowRange = True
    Selection.ShowValue = False
        Selection.Orientation = xlUpward
    Selection.Format.TextFrame2.Orientation = msoTextOrientationUpward
    Selection.Font.Size = 9
    Selection.Position = xlLabelPositionAbove
    With Selection.Format.fill
        .Visible = msoTrue
        .ForeColor.RGB = RGB(255, 255, 0)
        .Transparency = 0.3
        .Solid
    End With
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,191,576
Messages
5,987,397
Members
440,095
Latest member
yanaungmyint

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top