0
既存のワークシート上の特定の範囲のセルに縦棒グラフを配置する際に問題があります。助言を受けている人はいますか?また、棒の上にデータを表示する方法は?また、円グラフの凡例のサイズを変更するにはどうすればよいですか?前もって感謝します!既存のワークシート内の特定のセルに列チャートを配置するVB
Dim data As Worksheet
Dim colChart As Chart
Set data = ActiveWorkbook.Worksheets("Data") 'have charts in data ws
Set colChart = data.Shapes.AddChart.Chart ' set col chart
Set pieChart = data.Shapes.AddChart.Chart 'set pie chart
With colChart
.HasLegend = False 'no legend
.ChartType = xlColumnClustered 'clustered column
.SetSourceData Source:=Sheets("Data").Range("E2:E7"), PlotBy:=xlColumns
.HasTitle = True
.ChartTitle.Text = "Statictics on 50,000 Dice" 'title
.Axes(xlCategory, xlPrimary).HasTitle = True ' axis title
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Dice Face"
.Axes(xlValue, xlPrimary).HasTitle = True 'axis title
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "Counts"
End With
colChart.TopとcolChart.Leftを使用して、セルのTopプロパティとLeftプロパティを使用してチャートをセルに関連付けることができます。 –