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
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme