PDA

View Full Version : [SOLVED:] Newbie. Creating graphs on new sheets help.



deang88
06-21-2017, 12:12 PM
Hi I'm new to VBA and looking to learn something by reverse engineering.
Ideally, I want to create a bar chart for each person on a new sheet sequentially with the sheet titled with the persons name showing their progress in topic tests. The topics on the x-axis and "value added" on the y-axis
I've added a test file that I would like the code for so then I can learn from it to code my own larger sample.
Hoping its possible and you can help.
Thanks :)

mdmackillop
06-21-2017, 01:21 PM
Give this a try

Sub Test()
Dim r As Range, data As Range, cel As Range, nm As String
Dim sh As Worksheet, cht
Set sh = ActiveSheet
Set r = sh.Columns(1).SpecialCells(xlCellTypeConstants)
For Each cel In r.Cells
nm = cel.Offset(, 1) & ", " & cel
Set data = Union(sh.Range("C1:H1"), sh.Cells(cel.Row, "C").Resize(, 6))
Set cht = Sheets.Add(After:=Sheets(Sheets.Count), Count:=1, Type:=xlChart)
cht.Name = nm
cht.SetSourceData Source:=data
Next cel
End Sub

deang88
06-21-2017, 02:11 PM
Thank-you