I have made a code to create a graph with a selection
Option ExplicitSub Automatic_Graphs() Dim Actsheet As Worksheet Dim Selrange As Range Dim SourceRange As Range Dim COb As ChartObject Dim Ct As Chart Set Actsheet = ActiveSheet With Actsheet Set Selrange = Selection .Shapes.AddChart Set COb = .ChartObjects(.ChartObjects.Count) Set Ct = COb.Chart With Ct .ChartType = xlAreaStacked .SetSourceData Source:=Selrange .Legend.Select Selection.Delete .SetElement (msoElementPrimaryValueAxisTitleRotated) .Axes(xlValue, xlPrimary).AxisTitle.Text = "Graphic" .Axes(xlValue).MajorGridlines.Select .SeriesCollection(1).XValues = Selrange.Columns(1) Selection.Delete End With End With End Sub
The data has always the same structure
| Date | Brand 1 Data 1 | Brand 1 Data 2 | Brand 1 Data 3 |.... | Date | Brand 2 Data 1 | Brand 2 Data 2 | ....
I would like to know if there is a way to automate the graph creation selecting all the range and create graphs until the code finds "Date" (or the last data column before next Date), stops, create the graph and then run until the next "Date" stops, and so on. (I hope I had explain it well).
Thank you in advice