The part of code below is used to generate data label for a given data series and then color it. the code is running fine and color the data label whenever it has a value. however, when file is closed and then reopen if found that all data labels even if it is empty which creates bad chart outlook.
I need to color the datalabel that has value in it only and speed up the code little bit.
Please help.
I need to color the datalabel that has value in it only and speed up the code little bit.
Please help.
Code:
With .SeriesCollection.NewSeries .Name = "=" & COM.Name & "!R10C3"
.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("CENSYS").Select
.SeriesCollection("CENSYS").ApplyDataLabels
.SeriesCollection("CENSYS").DataLabels.Select
.SeriesCollection("CENSYS").DataLabels.Select
.SeriesCollection("CENSYS").DataLabels.Format.TextFrame2.TextRange. _
InsertChartField msoChartFieldRange, _
"=" & COM.Name & "!R" & 12 & "C" & (Currcol + 1) & ":R" & COM.Cells(1, 1).Value & "C" & (Currcol + 1) _
, 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