title: Excel VBA - Programmatically change chart's source?
body: <p>I've got this Excel document which contains several charts which target Named Ranges that are all predefined. The problem is, the reference the chart needs have to include the name of the document for some reason. I've managed to add the filename of the document in the sheet. But I cannot target this cell directly when assigning the source of the chart. </p>
  
  <p>So, when I edit the chart and select the source, it looks like this:</p>
  
  <pre><code>='MyExcelDocument.xlsm'!Graphs_TotCost
  </code></pre>
  
  <p>For some reason Excel doesn't understand when I target the cell that contains the filename. So I'll probably have to do this via a macro by first defining a string variable, assigning the document name to that string. And then assign the completed string combined with <code>Graphs_TotCost</code>. So, how do I select a chart that's in Sheet3 and change the source of that chart using a macro?</p>