VB
VBを使ってWindowsやOfficeソフトともっと仲良くなりましょう。
リファレンス
VBA
何も動作しないマクロ
一行コメント
コード置き場
VBA
選択したグラフのグラフタイトルや軸ラベルを適切な場所に設置するマクロ
- 作成者:S.T.30
- 説明:グラフタイトルが下にくるようにしました。
Sub グラフ作成補助()
'
'任意のグラフを選択した状態でマクロを実行せよ
'
'凡例削除
If ActiveChart.HasLegend Then
ActiveChart.Legend.Delete
End If
'
'x軸ラベル準備
ActiveChart.SetElement (msoElementPrimaryCategoryAxisTitleAdjacentToAxis)
ActiveChart.Axes(xlCategory).AxisTitle.Select
Selection.Text = "x []"
'
'y軸ラベル準備
ActiveChart.SetElement (msoElementPrimaryValueAxisTitleRotated)
ActiveChart.Axes(xlValue).AxisTitle.Select
Selection.Text = "x []"
'
'グラフタイトル準備
ActiveChart.SetElement (msoElementChartTitleAboveChart)
ActiveChart.ChartTitle.Select
Selection.Left = 60
Selection.Top = 180
Selection.Font.Size = 14
Selection.Text = "図 x"
ActiveChart.PlotArea.Select
Selection.Left = 15
Selection.Top = 5
Selection.Width = 335
Selection.Height = 160
'
'グラフを選択した状態に戻る
ActiveChart.ChartArea.Select
End Sub
最終更新:2013年08月12日 11:31