0

This is just a part of the code.

For i = 1 To Total_Graphs
    Sheet3.Select
    Num_Variables = Sheet2.Range("Num_Variables").Offset(i - 1, 0).Value
    ActiveSheet.Shapes.AddChart.Select
    ActiveChart.ChartType = xlLine
    ActiveChart.SetSourceData Source:=Sheet1.Range(Total_Variable_Range(i))
    For j = 1 To Num_Variables
    ActiveChart.SeriesCollection(j).Name = Sheet2.Range("List_format").Offset(i - 1, j - 1).Value
    Next j
Next i

Now, i want to name the chart created myself, instead of excel giving the name automatically.

Shashank
  • 43
  • 2
  • 2
  • 10

1 Answers1

0

For the naming, the AddChart method returns the Shape so you can set a variable this and work with it...

Dim s As Shape
Set s = ActiveSheet.Shapes.AddChart
s.Select
s.Name = "some name"
Captain
  • 2,148
  • 15
  • 13
  • [Avoid using select](http://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba-macros)...so probably `ws.Shapes(ws.Shapes.Count).Name = "new name"` –  Nov 04 '14 at 12:09