0

I'm trying to create a function where I can identify the chart I intend to populate on Sheet1. The chart will get its x-values and y-values based on a structured reference.

For example:

addTrend("Chart1","Sheet1",MyDataTable[MyXDataHeader],MyDataTable[MyYDataHeader])

I have been at this for hours and I cannot seem to find any available resources on how to

  • handle structured references in a user defined function and
  • get the desired data sources into the chart?
help-info.de
  • 6,695
  • 16
  • 39
  • 41
  • You are trying to populate a chart using a cell formula? A UDF cannot change the contents of cells or charts. What you need to do is write VBA code that does what you want, and trigger the code with a button. – John Alexiou Nov 19 '21 at 09:20
  • I have been able to alter charts with a UDF. In this instance I generate a string of the range I intend to use in the chart. cht.SeriesCollection(n).XValues = "=" & XValuesRng – Karsten Mikal Kopperstad Nov 19 '21 at 13:27

0 Answers0