Shuvro Basu
My feedback
-
73 votes4 comments · Excel for Windows (Desktop Application) » Charting, Mapping and Visualizations · Flag idea as inappropriate… · Admin →
Thank you for the suggestion on conditional format coloring for treemap charts! While we don’t expect to devote time to this in the near future, we will continue tracking votes and comments here. We will keep this suggestion under consideration for future development.
Thank you again,
Auston [MSFT]An error occurred while saving the comment -
19 votesAccepting Votes · 5 comments · Excel for Windows (Desktop Application) » Charting, Mapping and Visualizations · Flag idea as inappropriate… · Admin →
An error occurred while saving the comment Shuvro Basu commented
Yes you can do it but it's still a very cumbersome process. It's better to start off by recording a macro. This will have only 1 line of code, which is just what we need.
Sub Macro15()
'
' Macro15 Macro
''
Dim pnts As Integer
Dim NEG_COLOR As Long
NEG_COLOR = RGB(255, 0, 0)'The below line came from the macro recording
ActiveSheet.Shapes.Range(Array("Chart 5")).Select
'******************* MY CODE FOLLOWS *********************
'In my method I find the Datalabel of the box I want to change color using the DataLabel text and then change the color.
I didnt use the loop to run the code, because I wanted to test it first. And it works!!!'Use the below code to count the shapes in the treemap.
pnts = ActiveChart.FullSeriesCollection(1).Points.Count
'This is the core code
ActiveChart.FullSeriesCollection(1).Select'Check the shape you want by comparing the datalabel text
If ActiveChart.FullSeriesCollection(1).Points(x + 1).DataLabel.Text = "Type-DataLabel-That-You-Want" ThenActiveChart.FullSeriesCollection(1).Points(x + 1).Select
ActiveChart.FullSeriesCollection(1).Points(x + 1).Format.Fill.ForeColor.RGB = NEG_COLOR
End IfEnd Sub.
Hope this helps someone.
'Next
End Sub
Yes you can do it but it's still a very cumbersome process. It's better to start off by recording a macro. This will have only 1 line of code, which is just what we need.
Sub Macro15()
'
' Macro15 Macro
'
'
Dim pnts As Integer
Dim NEG_COLOR As Long
NEG_COLOR = RGB(255, 0, 0)
'The below line came from the macro recording
ActiveSheet.Shapes.Range(Array("Chart 5")).Select
'******************* MY CODE FOLLOWS *********************
'In my method I find the Datalabel of the box I want to change color using the DataLabel text and then change the color.
I didnt use the loop to run the code, because I wanted to test it first. And it works!!!
'Use the below code to count the shapes in the treemap.
pnts = ActiveChart.FullSeriesCollection(1).Points.Count
'This is the core code
ActiveChart.FullSeriesCollection(1).Select
'Check the shape you want by comparing the datalabel text
If ActiveChart.FullSeriesCollection(1).Points(x + 1).DataLabel.Text = "Type-DataLabel-That-You-Want" Then
ActiveChart.FullSeriesCollection(1).Points(x + 1).Select
ActiveChart.FullSeriesCollection(1).Points(x + 1).Format.Fill.ForeColor.RGB = NEG_COLOR
End If
End Sub.
Hope this helps someone.