View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
galimi galimi is offline
external usenet poster
 
Posts: 210
Default Discontiguous Chart Source

Ladymuck,

You could create a string that concatenates those range addresses &
separates them via a comma.
--
http://HelpExcel.com




"Ladymuck" wrote:

I would like to insert a pie chart where the source data is on the active
worksheet but comes from two discontiguous ranges (eg B2:C10 and B15:C15).

I have two ranges GBData, for the first range, and NonGBData for the second
range.

The following code sets the source data as B2:C15, which is incorrect. How
can I amend it to create the chart with only the data I want?

WShtName = ActiveSheet.Name
Charts.Add
ActiveChart.ChartType = xlPie
ActiveChart.SetSourceData Source:=Sheets(WShtName).Range( _
GBData.Address, NonGBData.Address), PlotBy:=xlColumns
ActiveChart.Location Whe=xlLocationAsObject, Name:=WShtName

Many thanks for any suggestions, happy New Year!