0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VBA エクセル 集合縦棒グラフ

Posted at

1.jpg

Sub 集合縦棒グラフの作成()
    With ActiveSheet.ChartObjects _
    .Add(400, 25, 450, 300).Chart
    .ChartType = xlColumnClustered
    .SetSourceData Source:=Range("B3:C22,E3:E22")
    .HasLegend = True
    .Legend.Position = xlLegendPositionBottom
    End With
    '第2軸の折れ線グラフを作成
    With ActiveSheet.ChartObjects(1).Chart.SeriesCollection(2)
        .ChartType = xlLineMarkers
        .Values = Range("E3:E22")
        .AxisGroup = xlSecondary
    End With
    '表示単位の変更
    With ActiveSheet.ChartObjects(1).Chart _
            .Axes(xlValue, xlPrimary)
            .DisplayUnit = xlMillions
            .DisplayUnitLabel.Orientation = xlHorizontal
    End With
    '第2軸をパーセント表示
    With ActiveSheet.ChartObjects(1).Chart _
        .Axes(xlValue, xlSecondary)
        .TickLabels.NumberFormatLocal = "0%"
    End With
End Sub

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?