Hi,
I have written the following:
If last_colnum = 5 Then
Application.Union(Columns(1), Columns(6)).Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
ElseIf last_colnum = 9 Then
Application.Union(Columns(1), Columns(6), Columns(10)).Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
ElseIf last_colnum = 13 Then
Application.Union(Columns(1), Columns(6), Columns(10), Columns(14)).Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
ElseIf last_colnum = 17 Then
Application.Union(Columns(1), Columns(6), Columns(10), Columns(14), Columns(18)).Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmoothNoMarkers).Select
...
This goes on for many more lines. Can someone pls show me how this can be converted to a for loop instead?
Thanks for any help.
Bookmarks