Question : Generate Excel Charts by offsetting series

 
gencharts
307251
 


Pls See attachment.

Trying to create a macro that will automatically generate charts and line them up (as attachment)  e.g.  starting from say G13 offsetting, creating charts,lining them up until it reaches an empty cell.
 (2 or 3 charts across and then going way down - this could reach 50 charts)

Answer : Generate Excel Charts by offsetting series

Try this macro

Sub arraychart()
    Set sr = Range("G13")
    For i = sr.Row To sr.End(xlDown).Row
    Charts.Add
    ActiveChart.ChartType = xlColumnClustered
    ActiveChart.SetSourceData Source:=Sheets("Sheet1").Range(sr.Offset(i - sr.Row, 0), sr.Offset(i - sr.Row, 3)), PlotBy:=xlRows
    ActiveChart.Location Where:=xlLocationAsObject, Name:="Sheet1"
    ActiveChart.Parent.Top = Int((i - sr.Row) / 2) * 200 + 300
    ActiveChart.Parent.Left = ((i - 1) Mod 2) * 300 + 100
    ActiveChart.Parent.Width = 300
    ActiveChart.Parent.Height = 200
    Next i
    Range("G13").Select
End Sub
Random Solutions  
 
programming4us programming4us