@niruniru

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

VBAで円グラフの色付けを項目名をキーに行いたいです

解決したいこと

VBAで円グラフの各要素の色付けについて、要素名称で判別し、要素毎に色付けできるようにしたいです。

発生している問題・エラー

要素名が格納されていると思われる、chart.SeriesCollection.point.Nameに名称ではない値が格納されており(S1P1、S1P2等)、上記ロジックが組めません。項目名称はどこに格納されていますか。もしくは、どのようなプログラムを組めば良いでしょうか。

該当するソースコード

Dim cht As Chart
Dim seriesnum As Integer
Dim datanum As Integer
Dim colormax As Integer
Dim pointnum As Integer
Dim chttype As Long
Dim i As Integer
Dim j As Integer

 Set cht = ActiveChart '選択中のグラフ
 With cht
 seriesnum = .SeriesCollection.Count '系列数取得

 For i = 1 To seriesnum '系列数分ループ
   With .SeriesCollection(i)
     ・・・

  chttype = .charttype 'グラフ種別取得

  Select Case chttype
   Case 5, 68, 69, 70, 71, -4102, -4120 '円グラフ
    pointnum = .Points.Count '要素数
     For j = 1 To pointnum
      With .Points(j)
       g_name = .Name
       (.NameにS1P1、S1P2といった値が格納されています。)

【補足情報】
 OS : Windows10
 OFFICE : Microsoft Office 2019

0 likes

No Answers yet.

Your answer might help someone💌