0

次のエラーが表示されるため、以下のコードに何か問題があると思います。Compile error: Next without For

コードの何が問題になっていますか? ありがとう!:)

Sub CreateCharts()

    Dim i As Integer
    For i = 3 To 5

        col = Columns(i).Select

        Dim xaxis As Range
        Dim yaxis As Range
        Set yaxis = Range("$" & col & "$152", "$" & col & "$156")
        Set xaxis = Range("$A$152", "$A$156")
        Dim c As Chart
        Set c = ActiveWorkbook.Charts.Add
        Set c = c.Location(Where:=xlLocationAsObject, Name:="Sheet1")
        c.ChartType = xlColumnClustered

        Dim s As Series
        Set s = c.SeriesCollection.NewSeries
        With s
            .Values = yaxis
            .XValues = xaxis

    Next i
End Sub
4

1 に答える 1