[[20210804091654]] 『VBA グラフの系列名 表示されない』(タム) ページの最後に飛ぶ

[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]

 

『VBA グラフの系列名 表示されない』(タム)

VBAでグラフを作成し、.Name = Range("B26") と記載しているのですが、
項目名が表示されず困っております。

どなたかご教示お願いします。

With ActiveSheet.ChartObjects(numGraph).Chart

     'グラフ種類 == 折れ線グラフに設定
    .ChartType = xlLine
    'タイトルを表示
     .HasTitle = True
     'タイトル位置指定
     .ChartTitle.Text = sh.Cells(1, i)
     '凡例の表示有無 有
     .HasLegend = True
    '凡例の表示位置 ==上
     .Legend.Position = xlTop
   End With

    With ActiveSheet.ChartObjects(numGraph).Chart.Axes(xlCategory, 1)
        .HasTitle = True '軸ラベルを表示
    End With

    '「X軸のデータ」と「1つ目の系列」を追加
    With ActiveSheet.ChartObjects(numGraph).Chart.SeriesCollection.NewSeries
        'X軸のデータ
        .XValues = sh.Range(sh.Cells(First_Row, 4), sh.Cells(First_Row + (23 * Date_weight), 4))
        'データ範囲
        .Values = sh.Range((sh.Cells(2, i).Address), sh.Cells(25, i).Address)
        . Name = Range("B2") '系列名
    End With

    '「2つ目の系列」を追加
    With ActiveSheet.ChartObjects(numGraph).Chart.SeriesCollection.NewSeries
        .Name = Range("B26") '系列名
        .Values = sh.Range((sh.Cells(26, i).Address), sh.Cells(49, i).Address)  'データ範囲
    End With

以下データ

MANE_ID ID
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64
402235 64

< 使用 Excel:Office365、使用 OS:Windows10 >


 ここに書いてあるだけじゃ不明確ですが、
 >.Name = Range("B26")  
  .Name = sh.Range("B26") 
 では?
(´・ω・`) 2021/08/04(水) 10:04

(´・ω・`) 様
ありがとうございました。
無事に解決できました。

本当にありがとうございました。
(タム) 2021/08/04(水) 10:12


コメント返信:

[ 一覧(最新更新順) ]


YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki. Modified by kazu.