0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBA エクセル グラフシート作成 埋め込みグラフ作成

Posted at

1.jpg
2.jpg

Sub グラフシートに作成()
'グラフシートにマーカー付折れ線グラフを作成
    With Charts.Add
        .ChartType = xlLineMarkers
        .SetSourceData Source:=Sheets("Sheet1").Range("A3:G8")
    End With
End Sub

3.jpg

Sub 埋め込みグラフを作成()
'横棒グラフの作成
    With ActiveSheet.ChartObjects.Add(10, 120, 400, 250).Chart
        .ChartType = 57
        .SetSourceData Source:=Range("A3:G8")
    End With
    'グラフタイトルの追加()
    With ActiveSheet.ChartObjects(1).Chart
        .HasTitle = True
        .ChartTitle.Characters.Text = "事業部別売上"
    '軸ラベルの追加()
        .Axes(xlCategory).HasTitle = True
        .Axes(xlCategory).AxisTitle.Characters.Text = "上半期"
        .Axes(xlValue).HasTitle = True
        .Axes(xlValue).AxisTitle.Characters.Text = "金額"
    '軸ラベルの書式設定()
    '項目軸ラベルの文字列を縦に
        .Axes(xlCategory).AxisTitle.Orientation = xlVertical
    'グラフタイトルの文字サイズ変更()
        .ChartTitle.Font.Size = 14
     End With
End Sub


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?