colorize a sunburstchart with given cells

SiriKlaus

New Member
Joined
Feb 14, 2018
Messages
1
Dear MrExcel community,

I would like to color the cells in my sunburst chart in the same color like the cells inside a table from another workbook.
It seems that programming a sunburst might not have too many threads. Nevertheless, I'm sure and I hope you will help me finding a proper solution :-)
The cells in the table are to be read in columns, while the same values in the sunburst are to be read in one circle. Vice versa, one row in the table is to be read from the center to the outer part of the sunburst.
Here is a piece of a code, I wrote, to color the second circle (first circle is the center of the sunburst chart).
Code:
Option Explicit
Dim thisworkbook As Workbook
Dim i As Integer
Dim c As Integer
Dim z As Integer
Dim farbe As Integer
Dim Urtabelle As worksheet
dim wkbdaten as workbook
Dim rng As Range
 
Sub sun()
 
On Error GoTo FEH
'
With Application
    .ScreenUpdating = False
    .EnableEvents = False
    .Calculation = xlCalculationManual
End With
'
    Workbooks.Open "L:\...\name.xlsm"
Set wkbDaten = Workbooks("table.xlsm")
Set Urtabelle = wkbDaten.Sheets("table-SHEET")
 
FEH:
With Application
    .ScreenUpdating = True
    .EnableEvents = True
    .Calculation = xlCalculationAutomatic
End With
 
 
'How many circles do we have? 
 
c = 0
 
For z = 1 To 50
If Cells(z, 1) > 0 Then
c = c + 1
End If
Next z
 
 
 
 
For i = 6 To c 
 
'color the cells in the second circle inside of the sunburst 
 
farbe = table.Cells(i, 2).Interior.Color
 
    If table.Cells(i, 2).Value <> Empty Then
 
    ThisWorkbook.Sheets("Tabelle6").FullSeriesCollection(2).Points(i).Select
        With Selection.Format.Fill
        .Visible = msoTrue
        .ForeColorindex = farbe
        .Transparency = 0
        .Solid
        End With
 
    End If
   
End Sub

Please feel free to ask for further information (I also can send you the files) at any time - I will reply as soon as possible.

Many thanks!!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Forum statistics

Threads
1,223,243
Messages
6,170,971
Members
452,371
Latest member
Frana

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
Back
Top