Graphing with NAMED RANGES - VBA II

Terry_Orange

Board Regular
Joined
Jul 22, 2002
Messages
133
Please ignore the last post !

Having established how to construct a graph with a named range, can anyone give me advice on how to use more than one range in a graph.

ie.

ActiveChart.SetSourceData Source:=myRange1, PlotBy:=xlRows

WORKS.

but if I want more than one range in my source

ActiveChart.SetSourceData Source:=(myRange1,myRange2,myRange3), PlotBy:=xlRows

DOESN'T WORK.

Anyone any ideas ???
Nick.
This message was edited by Terry_Orange on 2002-10-03 07:20
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Damon Ostrander

MrExcel MVP
Joined
Feb 17, 2002
Messages
4,239
Hi Nick,

I believe you should be able to use square brackets:

ActiveChart.SetSourceData Source:=[myRange1,myRange2,myRange3], PlotBy:=xlRows

so long as the three ranges are all on the active worksheet. The square brackets are just a shorthand alternative to

Range("myRange1,myRange2,myRange3")

to return a range object that includes all three ranges.

Damon
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Or you can create a Range object using the Union method and pass that variable as the Source.
 

Forum statistics

Threads
1,143,752
Messages
5,720,637
Members
422,295
Latest member
Ryamker3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top