Excel実行画面
・ 通常の円グラフ D1:F13がグラフデータです。
・ 3-D円、補助円グラフ付き円
・ 分割円、分割 3-D円、補助縦棒グラフ付き円
Excel VBA実行コード
Option Explicit
Private Sub CommandButton3_Click()
Dim trange As Range
Dim tCh As ChartObject
Dim ypos As Long
Dim stname As String
stname = ActiveSheet.Name
Set trange = Worksheets("Sheet1").Range("D1:F13")
ypos = 220
'作成領域
Set tCh = Worksheets("sheet1").ChartObjects.Add(20, ypos, 400, 200)
'円
tCh.Chart.ChartType = xlPie
tCh.Chart.SetSourceData Source:=trange, PlotBy:=xlColumns
tCh.Chart.HasTitle = True
tCh.Chart.ChartTitle.Characters.Text = "売上推移 円"
'作成領域
ypos = ypos + 220
Set tCh = Worksheets("sheet1").ChartObjects.Add(20, ypos, 400, 200)
'3-D 円
tCh.Chart.ChartType = xl3DPie
tCh.Chart.SetSourceData Source:=trange, PlotBy:=xlColumns
tCh.Chart.HasTitle = True
tCh.Chart.ChartTitle.Characters.Text = "売上推移 3-D 円"
'作成領域
ypos = ypos + 220
Set tCh = Worksheets("sheet1").ChartObjects.Add(20, ypos, 400, 200)
'補助円グラフ付き円
tCh.Chart.ChartType = xlPieOfPie
tCh.Chart.SetSourceData Source:=trange, PlotBy:=xlColumns
tCh.Chart.HasTitle = True
tCh.Chart.ChartTitle.Characters.Text = "売上推移 補助円グラフ付き円"
'作成領域
ypos = ypos + 220
Set tCh = Worksheets("sheet1").ChartObjects.Add(20, ypos, 400, 200)
'3-D 分割円
tCh.Chart.ChartType = xlPieExploded
tCh.Chart.SetSourceData Source:=trange, PlotBy:=xlColumns
tCh.Chart.HasTitle = True
tCh.Chart.ChartTitle.Characters.Text = "売上推移 分割円"
'作成領域
ypos = ypos + 220
Set tCh = Worksheets("sheet1").ChartObjects.Add(20, ypos, 400, 200)
'分割 3-D 円
tCh.Chart.ChartType = xl3DPieExploded
tCh.Chart.SetSourceData Source:=trange, PlotBy:=xlColumns
tCh.Chart.HasTitle = True
tCh.Chart.ChartTitle.Characters.Text = "売上推移 分割 3-D 円"
'作成領域
ypos = ypos + 220
Set tCh = Worksheets("sheet1").ChartObjects.Add(20, ypos, 400, 200)
'補助縦棒グラフ付き円
tCh.Chart.ChartType = xlBarOfPie
tCh.Chart.SetSourceData Source:=trange, PlotBy:=xlColumns
tCh.Chart.HasTitle = True
tCh.Chart.ChartTitle.Characters.Text = "売上推移 補助縦棒グラフ付き円"
End Sub