Sub 出来高小グラフ() Dim evra As String Dim evrb As Integer evra = Application.Version evrb = Val(Left(evra, 2)) Application.ScreenUpdating = False ActiveSheet.Unprotect 'チャート幅を確保 Rows("2:2").RowHeight = 260 shname = ActiveSheet.Name ' 旧グラフ削除 For Each zu In ActiveSheet.Shapes zu.Delete Next 'グラフ目盛り最小値 Set myrang = Range(Cells(4, 4), Cells(GYOU, 4)) yasune = Application.WorksheetFunction.Min(myrang) 'グラフ作成 If evrb = 12 Then For i = 4 To GYOU Cells(i, 13) = Cells(GYOU + 4 - i, 6) Cells(i, 14) = Cells(GYOU + 4 - i, 10) Next Else For i = 4 To GYOU Cells(i, 13) = Cells(i, 6) Cells(i, 14) = Cells(i, 10) Next End If Cells(3, 13) = Cells(3, 6) Cells(3, 14) = Cells(3, 10) Set rangch = Union(Range(Cells(3, 1), Cells(GYOU, 1)), _ Range(Cells(3, 9), Cells(GYOU, 9)), _ Range(Cells(3, 11), Cells(GYOU, 14))) '6→13、10→14 ActiveSheet.ChartObjects.Add(5, 18, 550, 250).Select ActiveChart.ChartType = xlLineMarkers ActiveChart.SetSourceData Source:=rangch, PlotBy _ :=xlColumns ActiveChart.Location Where:=xlLocationAsObject, Name:=shname 'データのある日のみ表示 ActiveChart.Axes(xlCategory, xlPrimary).CategoryType = xlCategoryScale '軸の反転 With ActiveChart.Axes(xlCategory) .AxisBetweenCategories = True .ReversePlotOrder = True End With 'グループ2へ分離 ActiveChart.SeriesCollection(5).AxisGroup = 2 '3→5 ActiveChart.SeriesCollection(4).AxisGroup = 2 '1→4 '右縦列文字調整 With ActiveChart.Axes(xlValue) .TickLabels.Font.Size = 8 .TickLabels.NumberFormatLocal = "0_ " End With '左縦列文字調整 With ActiveChart.Axes(xlValue, xlSecondary) .TickLabels.Font.Size = 8 If .MaximumScale < 1001 Then .MinimumScale = Int(Int(yasune * 0.8) / 10) * 10 Else .MinimumScale = Int(Int(yasune * 0.8) / 100) * 100 End If End With '下列文字調整 With ActiveChart.Axes(xlCategory).TickLabels .Font.Size = 8 .NumberFormatLocal = "yy/mm/dd" .Orientation = xlDownward End With 'プロットエリアの色 ActiveChart.PlotArea.Interior.ColorIndex = 2 '凡例位置調整 ActiveChart.Legend.Position = xlBottom '終値の色 ActiveChart.SeriesCollection(4).Select '1→4 With Selection.Border .ColorIndex = 1 .Weight = xlThin .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = 49 .MarkerForegroundColorIndex = 49 .MarkerStyle = xlDiamond .Smooth = False .MarkerSize = 4 .Shadow = False End With '出来高移動平均3日 ActiveChart.SeriesCollection(1).Select '2→1 With Selection.Border .ColorIndex = 7 .Weight = xlThin .LineStyle = xlContinuous End With With Selection .MarkerBackgroundColorIndex = 7 .MarkerForegroundColorIndex = 7 .MarkerStyle = xlSquare .Smooth = False .MarkerSize = 4 .Shadow = False End With '終値移動平均**日 With ActiveChart.SeriesCollection(5) '3→5 .Border.ColorIndex = 5 .Border.Weight = xlHairline .Border.LineStyle = xlDot .MarkerStyle = xlNone End With 'I列の最小値(過去**日) With ActiveChart.SeriesCollection(2) '4→2 .Border.ColorIndex = 38 .Border.Weight = xlHairline .Border.LineStyle = xlDot .MarkerStyle = xlNone End With 'I列の最大値(過去**日) With ActiveChart.SeriesCollection(3) '5→3 .Border.ColorIndex = 54 .Border.Weight = xlHairline .Border.LineStyle = xlDot .MarkerStyle = xlNone End With Range("G1").Select ActiveSheet.Protect DrawingObjects:=True End Sub