View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ladymuck Ladymuck is offline
external usenet poster
 
Posts: 45
Default Discontiguous Chart Source

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!