So I am very new to coding to VBA or to programming in general. I am receiving a "Compile error: Next without for". I believe I am giving 3 nexts for 3 fors but still I have no clue. Below is the code I am working on....
Sub width2() 'to assign series width automatically
For Series = 1 To 24 'chart series, 144 combinations
For i = 0 To 1
For j = 0 To 11
ActiveSheet.ChartObjects("Chart 4").Activate
ActiveChart.FullSeriesCollection(Series).Select
With Selection.Format.Line
.Visible = msoTrue
.Weight = Sheet5.Range("Q9").Offset((9 * i) + 6, (3 * j)).Value
Next j
Next i
Next Series
End Sub
Not sure where the mistake is. Any help much appreciated Thank you.
End Withto yourWith Selection.Format.LineWithmethod. You do not closeWith. You have to useEnd WithbeforeNext j.Chart 4in your active sheet...End With, so we will remove that error from you post. Secod, you need to take yourActiveSheet.ChartObjects("Chart 4").Activateand the following line from inside the nestedForloops to be the first line in yourSub. Just keep the.Weight = Sheet5.Range("Q9").Offset((9 * i) + 6, (3 * j)).Valueinside