- 2008年4月15日 08:29
- Excel VBA | GraphControl
エクセル3DグラフのX軸高さの比率を設定するマクロを紹介します。
introducing the excel's source code of setting the 3D chart (.HeightPercent).
下のコードは、グラフ(1)のX軸の高さ(%)を10アップさせるマクロです。高さの範囲は0~100%ですので100を超えたらイグジットします。 変数HeightPをLong型で宣言して、高さを一旦格納して、10足した値でグラフを設定します。
The code below is to increase height of the selected chart by 10. Declare var HeightP as Long and store the value of HeightPercent. Before setting the value of 3D chart, invalidate automatic scalling of X-axis. The range of HeightPercent is from 0 to 100, so that in case the value exceed 100 then exit sub.
下記はGraphControl で使用しているマクロです。スピンボタンを使う方法もありますが、GraphControl のコードは高さを増減させるためにコマンドボタンを2つ使っています。
The code below is the source code used in GraphControl. I use two command buttons to increase and decrease the value of HeightPercent. It's also possible to use spinbutton instead of command buttons. var NumChart indicate the number of charts on selected sheet.
Search