G
Guest
Using the following code in VBA from this forum, I was able to revise the
line chart series to adhere to presentation guidelines...
With Chart.SeriesCollection(i)
.Border.ColorIndex = Index
.Border.Weight = xlMedium
.MarkerStyle = xlNone
End With
However, I started getting a VBA error stating that the VBA code could no
longer revise the chart. For a while I could not figure why the code decided
not to work. After some research, I realized that the user has selected
December and that no values for December have been collected for the chart.
You cannot revise a series that has no values. But I still wanted the legend
to reflect the formatting requirements. Ah... the legend. After some
additional research, I changed the VBA code to .....
With Chart.Legend.LegendEntries(i).LegendKey
.Border.ColorIndex = Index
.Border.Weight = xlMedium
.MarkerStyle = xlNone
End With
This will work whether or not the series has values. And when you change the
legend key, it changes the seriescollection formats at the same.
So if you have a possibility that your chart series might not have any data
to chart but you want the series/legend to be formatted a certain way, I
think will do the trick.
If anyone has any comments, or if there is any other words of wisdom on this
subject, please post ot this thread.
Thank you in advance for taking the time to view this rambling.
line chart series to adhere to presentation guidelines...
With Chart.SeriesCollection(i)
.Border.ColorIndex = Index
.Border.Weight = xlMedium
.MarkerStyle = xlNone
End With
However, I started getting a VBA error stating that the VBA code could no
longer revise the chart. For a while I could not figure why the code decided
not to work. After some research, I realized that the user has selected
December and that no values for December have been collected for the chart.
You cannot revise a series that has no values. But I still wanted the legend
to reflect the formatting requirements. Ah... the legend. After some
additional research, I changed the VBA code to .....
With Chart.Legend.LegendEntries(i).LegendKey
.Border.ColorIndex = Index
.Border.Weight = xlMedium
.MarkerStyle = xlNone
End With
This will work whether or not the series has values. And when you change the
legend key, it changes the seriescollection formats at the same.
So if you have a possibility that your chart series might not have any data
to chart but you want the series/legend to be formatted a certain way, I
think will do the trick.
If anyone has any comments, or if there is any other words of wisdom on this
subject, please post ot this thread.
Thank you in advance for taking the time to view this rambling.