title: Naming and referring to a chart in VBA
body: <p>I am trying to create charts in excel using VBA . The code is as follows :</p>
  
  <pre><code>Sub testmacro()    
      Dim i As Integer     
      i = Sheets("Data").Range("M2").Value
    Sheets("Email ID").Activate
      Range("A1").Select
      ActiveSheet.Shapes.AddChart.Select
      ActiveChart.ChartType = xlColumnClustered
  
      If i = 1 Then  
          ActiveChart.SetSourceData Source:=Range("Data!$E$1:$F$3")        
      ActiveChart.SeriesCollection(1).Select
      With Selection.Format.Fill
         .
         .
         .        
      End If     
  
      If i = 2 Then
  
     End if
  
     If i=3 Then  
  
      End If   
  
  End Sub
  </code></pre>
  
  <p>Now, I want to be able to perform the actions when i=2 and i=3 on the same chart i created when i=1</p>
  
  <p>However, I am not able to do so.</p>
  
  <p>So can anyone help me <strong>how to give a name for the chart i created when i=1 and be able to refer to it whie i=2 and i=3</strong>??</p>