Sub 出来高大グラフ() Dim evra As String Dim evrb As Integer Dim kari2 As Range 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 = 11 Then For i = 4 To GYOU Cells(i, 19) = Cells(GYOU + 4 - i, 10) Cells(i, 20) = Cells(GYOU + 4 - i, 11) Next Range(Cells(4, 19), Cells(GYOU, 19)).Copy Range(Cells(4, 10), Cells(GYOU, 10)) Range(Cells(4, 20), Cells(GYOU, 20)).Copy Range(Cells(4, 11), Cells(GYOU, 11)) End If 'グラフ作成 Set rangch = Union(Range(Cells(3, 1), Cells(GYOU, 1)), _ Range(Cells(3, 6), Cells(GYOU, 6)), _ Range(Cells(3, 10), Cells(GYOU, 11)), _ Range(Cells(3, 16), Cells(GYOU, 17)), _ Range(Cells(3, 14), Cells(GYOU, 14)), _ Range(Cells(3, 18), Cells(GYOU, 18))) 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(3).AxisGroup = 2 ActiveChart.SeriesCollection(2).AxisGroup = 2 '左縦列文字調整 With ActiveChart.Axes(xlValue) .TickLabels.Font.Size = 8 If .MaximumScale < 1001 Then .MinimumScale = Int(Int(yasune * 0.9) / 10) * 10 Else .MinimumScale = Int(Int(yasune * 0.9) / 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 '終値の色 With ActiveChart.SeriesCollection(1) .Border.ColorIndex = 1 .Border.Weight = xlMedium .Border.LineStyle = xlContinuous .MarkerBackgroundColorIndex = 1 .MarkerForegroundColorIndex = 1 .MarkerStyle = xlDiamond .MarkerSize = 5 End With '出来高指数 With ActiveChart.SeriesCollection(2) .Border.ColorIndex = 5 .Border.Weight = xlThick .Border.LineStyle = xlGray75 .MarkerStyle = xlNone End With '値上げ率 With ActiveChart.SeriesCollection(3) .Border.ColorIndex = 7 .Border.Weight = xlMedium .Border.LineStyle = xlContinuous .MarkerStyle = xlNone End With '終値5日平均 With ActiveChart.SeriesCollection(5) .Border.ColorIndex = 11 .Border.Weight = xlThin .Border.LineStyle = xlContinuous .MarkerStyle = xlNone End With '終値22日平均 With ActiveChart.SeriesCollection(6) .Border.ColorIndex = 3 .Border.Weight = xlThin .Border.LineStyle = xlDot .MarkerStyle = xlNone End With '雲の色付け ActiveChart.SeriesCollection(4).ChartType = xlAreaStacked ActiveChart.SeriesCollection(7).ChartType = xlAreaStacked ActiveChart.SeriesCollection(4).Interior.ColorIndex = xlNone ActiveChart.SeriesCollection(7).Select With Selection.Border .Weight = xlThin .LineStyle = xlAutomatic End With Selection.Shadow = False With Selection.Interior .ColorIndex = 35 .Pattern = xlSolid End With ActiveSheet.Protect DrawingObjects:=True Range("G1").Select End Sub