computer/windows/VBA
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
単語検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
#highlighter(VBScript){{
Sub GraphResize()
'---------------------------------------
'システム:グラフサイズ取得
'[変更履歴]
'2015/10/31 T. Ono 新規作成
'---------------------------------------
a = 240
b = 180
If ActiveChart Is Nothing Then
MsgBox ("グラフを選択して下さい")
Exit Sub
End If
With ActiveChart.Parent
.Width = a
.Height = b
End With
End Sub
}}
#highlighter(VBScript){{
Sub Sample00()
' With Range("B7:E15")
ActiveSheet.ChartObjects("グラフ 2").width = 300
ActiveSheet.ChartObjects("グラフ 2").height = 400
'End With
End Sub
Sub Sample01()
With ActiveSheet.ChartObjects(1)
.Name = "俺のグラフ1"
MsgBox .Name & vbCrLf & _
.Chart.Name
End With
End Sub
Sub Sample02()
Dim Rng As Range
Set Rng = Range("B8:E18") '--サイズを合わせるセル範囲
With ActiveSheet.ChartObjects(1) '--1つめのグラフに関して
.Top = Rng.Top '--上端を合わせる
.Left = Rng.Left '--左端を合わせる
.width = Rng.width '--幅を合わせる
.height = Rng.height '--高さを合わせる
End With
End Sub
Sub Sample03()
Charts(2).Activate
With ActiveChart
.Type = xlLine
.HasTitle = True
.ChartTitle.Text = "January Sales"
End With
End Sub
Sub graph_reset()
Dim ch As ChartObject
If ActiveChart Is Nothing Then Exit Sub
With ActiveChart
With .Parent
.width = 228
.height = 228
End With
End With
End Sub
Sub sample04()
If ActiveChart Is Nothing Then
MsgBox ("グラフを選択して下さい")
Exit Sub
End If
End Sub
}}
#highlighter(VBScript){{
Sub graph_area()
With ActiveChart
With .Parent
.Width = 270
.Height = 230
End With
With .PlotArea
.Top = 0
.Left = 25
.Width = 230
.Height = 200
End With
End With
End Sub
}}
終了行:
#highlighter(VBScript){{
Sub GraphResize()
'---------------------------------------
'システム:グラフサイズ取得
'[変更履歴]
'2015/10/31 T. Ono 新規作成
'---------------------------------------
a = 240
b = 180
If ActiveChart Is Nothing Then
MsgBox ("グラフを選択して下さい")
Exit Sub
End If
With ActiveChart.Parent
.Width = a
.Height = b
End With
End Sub
}}
#highlighter(VBScript){{
Sub Sample00()
' With Range("B7:E15")
ActiveSheet.ChartObjects("グラフ 2").width = 300
ActiveSheet.ChartObjects("グラフ 2").height = 400
'End With
End Sub
Sub Sample01()
With ActiveSheet.ChartObjects(1)
.Name = "俺のグラフ1"
MsgBox .Name & vbCrLf & _
.Chart.Name
End With
End Sub
Sub Sample02()
Dim Rng As Range
Set Rng = Range("B8:E18") '--サイズを合わせるセル範囲
With ActiveSheet.ChartObjects(1) '--1つめのグラフに関して
.Top = Rng.Top '--上端を合わせる
.Left = Rng.Left '--左端を合わせる
.width = Rng.width '--幅を合わせる
.height = Rng.height '--高さを合わせる
End With
End Sub
Sub Sample03()
Charts(2).Activate
With ActiveChart
.Type = xlLine
.HasTitle = True
.ChartTitle.Text = "January Sales"
End With
End Sub
Sub graph_reset()
Dim ch As ChartObject
If ActiveChart Is Nothing Then Exit Sub
With ActiveChart
With .Parent
.width = 228
.height = 228
End With
End With
End Sub
Sub sample04()
If ActiveChart Is Nothing Then
MsgBox ("グラフを選択して下さい")
Exit Sub
End If
End Sub
}}
#highlighter(VBScript){{
Sub graph_area()
With ActiveChart
With .Parent
.Width = 270
.Height = 230
End With
With .PlotArea
.Top = 0
.Left = 25
.Width = 230
.Height = 200
End With
End With
End Sub
}}
ページ名: