Excel automation - Range - select separated columns

11 views
Skip to first unread message

Patronus

unread,
Jul 3, 2009, 12:49:36 PM7/3/09
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
Hi there,

I'm working on a program that dinamically generates an excel
spreadsheet, but i found a problem when I have to generate a chart
that contains data from multiple separeted columns.

The code is the following:

Dim oChart As Excel.Chart
Dim MyCharts As Excel.ChartObjects
Dim MyCharts1 As Excel.ChartObject
MyCharts = xlWorkSheet.ChartObjects
MyCharts1 = MyCharts.Add(150, 30, 400, 250)
oChart = MyCharts1.Chart
With oChart
'set data range for chart
Dim chartRange As Excel.Range
chartRange = xlWorkSheet.Range("A3", "E50")
.SetSourceData(chartRange)
...

This works fine for A3:C50 range, but i can't figure out a way of
handeling ranges like A3:A50 & D3:E50.

Any ideia would be appreciated

Thanks,
José

Reply all
Reply to author
Forward
0 new messages