0

I want to change the Xvalues in excel chart using Interop. Following is what I am using. But it is not recognising Range.

Can anybody help me solve this?

    chartPage.SetSourceData Range("A2:A4"), xlColumns
    chartPage.SeriesCollection(1).XValues = Range("B2:B4")

It is not accepting Range, everywhere I am finding same answer.

Sanju
  • 85
  • 2
  • 3
  • 10
  • That looks like VBA code and not C#. The answers to http://stackoverflow.com/questions/175763/resources-for-learning-c-sharp-excel-interop may be helpful – barrowc Feb 12 '13 at 02:48

1 Answers1

0

Try to get the active worksheet and use range on it. Something like this:

_Worksheet ws = this.ActiveSheet
chartPage.SeriesCollection(1).XValues = ws.Range("B2:B4")
Mitja Bezenšek
  • 2,503
  • 1
  • 14
  • 17