grayscale plot with bars

C

chris.ammann

Hi,

is Excel able to color the bars of a bar chart according to the height
of the respective bar?

The surface plot would be an alternative but I cannot change the
colors?

Can anybody help?
Chris
 
C

chris.ammann

Thanks for your reply, Andy.

The method you suggest goes into the right direction but they take too
much handwork for what I had in mind.

As far as I understand it Excel just doesn't have the necessary options
integrated. I think I have to write a small VB piece.

Regards,
Chris
 
A

Andy Pope

Maybe this code, from one of my previous posts, will help.

'--------------------------------
Sub ColorColumns()

Dim vntValues As Variant
Dim intSeries As Integer
Dim intPoint As Integer
Dim objChart As ChartObject

For Each objChart In ActiveSheet.ChartObjects
With objChart.Chart
For intSeries = 1 To .SeriesCollection.Count
With .SeriesCollection(intSeries)
vntValues = .Values
For intPoint = 1 To .Points.Count
If vntValues(intPoint) < 60 Then
.Points(intPoint).Interior.Color = vbRed
ElseIf vntValues(intPoint) >= 60 And _
vntValues(intPoint) < 80 Then
.Points(intPoint).Interior.Color = vbYellow
Else
.Points(intPoint).Interior.Color = vbGreen
End If
Next
End With
Next
End With
Next

End Sub
'----------------

Cheers
Andy
 
R

renderman

Hi Andy,

my code looks more or less the same.

However, I tried to assign the colors via the RGB function but I ran
into another problem. I've the feeling that the color from the palette
that is closest to my RGB color is assigned. Is it possible to assign a
really arbitrary color?

Regards,
Chris
 
A

Andy Pope

Hi,

Not directly. As you say the colour nearest to one contained in the
palette is used. So you would need to adjust a colour within the palette
in order to use it in the chart.

Cheers
Andy
 
R

renderman

I feared that you would say that. A change in the palette will effect
all other charts in the workbook as well, correct?
 
Top