Hi,
I’m extremely new to VBA and macros, literally started teaching myself yesterday to make better/more efficient graphs to represent data for work, so please forgive me for my inexperience.
But I'm compiling data into Bar of Pie charts and am wondering if it's at all possible to program the "Other" slice to be a certain color. The macros I made uses colors that are predetermined from the cells on excel, but... - The charts don't have the same splitting point (where the "Other slice occurs") for the second plot because the data sets don't have the same number of datums
- The range for the chart is based off of what I select.
If someone could help, or even have suggestions for a more efficient way to format this, it would be greatly appreciated. Below is what I have so far in VBA. Thank you!
Sub BarofPieFillColor()
'
' BarofPieFillColor Macro
'
Set SelectedCells = Selection
'
ActiveSheet.Shapes.AddChart.Select
ActiveChart.ChartType = xlBarOfPie
ActiveChart.SetSourceData Source:=SelectedCells, PlotBy:=xlColumns
ActiveChart.ClearToMatchStyle
ActiveChart.ChartStyle = 10
ActiveChart.ClearToMatchStyle
ActiveChart.SetElement (msoElementDataLabelCenter)
ActiveChart.ApplyLayout (7)
ActiveChart.ApplyDataLabels
ActiveChart.SeriesCollection(1).DataLabels.Select
ActiveChart.ChartGroups(1).SecondPlotSize = 200
Selection.Position = xlLabelPositionCenter
Selection.Separator = "; "
Selection.ShowCategoryName = True
Selection.ShowPercentage = True
Selection.ShowValue = False
Selection.Format.TextFrame2.TextRange.Font.Size = 14
Selection.Format.TextFrame2.TextRange.Font.Bold = msoTrue
Application.Run "PERSONAL.XLSB!ColorPies" <(using another macros I found online within this macros.)
ActiveChart.PlotArea.Select
End Sub
Bookmarks