在折線圖上畫一個垂直線,然後是根據副軸座標來標示相同日期在主座標上
圖表名、X標籤資料位置,Y軸資料位置
Sub 巨集3(Name, rngXValues, 垂直線)
If InStr(Name, "Chart") > 0 Then
'Range("L17").Select
ActiveSheet.ChartObjects(Name).Activate
ActiveChart.PlotArea.Select
Application.CutCopyMode = False
Application.CutCopyMode = False
ActiveChart.SeriesCollection.NewSeries
ActiveChart.FullSeriesCollection(2).Values = "=" & ActiveSheet.Name & "!" & 垂直線.Address ' "=工作表3!$G$2:$G$148"
ActiveChart.FullSeriesCollection(2).Name = "=""垂直線"""
ActiveChart.FullSeriesCollection(2).XValues = "=" & ActiveSheet.Name & "!" & rngXValues.Address '"=工作表3!$A$149:$A$295"
ActiveChart.Axes(xlValue).MajorGridlines.Select
ActiveChart.ChartArea.Select
ActiveChart.ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(1).ChartType = xlLine
ActiveChart.FullSeriesCollection(2).ChartType = xlColumnClustered
ActiveChart.FullSeriesCollection(2).AxisGroup = 2
End If
End Sub
沒有留言:
張貼留言