ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating Graphs + VBA (https://www.excelbanter.com/excel-programming/438823-creating-graphs-vba.html)

Sduduzo

Creating Graphs + VBA
 
Hi All

I have a bunch of data that I need to graph. The data basically contains
statistics per person (Min,Max and AVG). I have this in 100 rows.

I need to create a bar chart per person with their stats in graph.

I found the code below to create the grpahs, but I cannot get it to show my
series labels correctly, they just show up as Series1, Series2, Series3,
where as I need it to show Min, Max, Avg :

Sub CreateBarCharts()
Dim ws As Worksheet, cel As Range

Set ws = ActiveSheet
With ws
For Each cel In .Range(.[A2], .Cells(.Rows.Count, "A").End(xlUp))
With Charts.Add
.ChartType = xlColumnClustered
.SetSourceData Source:=cel.Resize(1, 8), PlotBy:=xlRows
.Location Whe=xlLocationAsNewSheet
.HasTitle = True
.ChartTitle.Characters.Text = cel.Value
With .Axes(xlCategory, xlPrimary)
.HasTitle = True
.AxisTitle.Characters.Text = ws.[A1]
End With
End With
Next cel
End With

End Sub


Any help would be appreciated.


All times are GMT +1. The time now is 04:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com