title: VBA - change of the XValues with variables
body: <p>I am completely new in the realm of programming and am starting to learn VBA for Modelling financial scenarios in Excel.
  Now I have a question regarding the change of the XValues of Chart in order to change the dates presented to me of a given data Set.</p>
  
  <p>I use Variables that store the first and last row number of the series which I want to use to give VBA a varying range to choose the XValues from based on how I define the variables.
  The variables are defined as integers.</p>
  
  <p>My code:</p>
  
  <pre><code>Sheets("Result").ChartObjects("Chart 2").Activate
  ActiveChart.FullSeriesCollection(1).XValues = ActiveWorkbook.Sheets("Data_Portfolio").Range(Cells(RangeStart, 1), Cells(RangeStop, 1))
  </code></pre>
  
  <p>It would be very kind for you to explain to me what is wrong with the second row and how I can solve the "application-defined or object-defined error".</p>
  
  <p>I thank you all in advance,</p>
  
  <p>Nick</p>