2017-01-24 11 views
0

以下のコードはデータポイントのラベル値に基づいてバーの色を変更しますが、同じ値を持つ複数のポイントがあります。色をつけてください。軸のテキストに基づいてコードを変更するにはどうすればよいですか?例えばデータポイント値ではなく軸テキストに基づくカラーバー - EXCEL VBA

x1 = ws2.Cells(icounter, 3) 
Set ch = ActiveChart 
Set s = ch.SeriesCollection(1) 


nPoint = s.Points.Count 
For iPoint = 1 To nPoint 
If Format(x1, "0.00%") = s.Points(iPoint).DataLabel.Text Then 
s.Points(iPoint).Format.Fill.ForeColor.RGB = RGB(192, 0, 0) 
End If 
Next iPoint 

これらのバーはBKのEMEAのCEと同じデータポイントの値を持っているので、下の写真では、「BK EMEAのCE」以外のバーが着色されています。私は

答えて

0

for example, in picture below, bars other than "bK EMEA ce" is colored because those bars have the same data point value as bk emea ce. I only want bk emea ce colored red

赤色BK EMEA CEはそれを考え出したいです。

If ws2.Cells(icounter, 2) = s.XValues(iPoint) Then 
ため

スワップ

If Format(x1, "0.00%") = s.Points(iPoint).DataLabel.Text Then 

関連する問題