Discontiguous Chart Source
Thanks Tim, very simple solution and it worked a treat. Can't believe I
missed that.
Cheers!
"Tom Ogilvy" wrote:
Even manually, those ranges don't come out properly, but to get the string
you want to get:
ActiveChart.SetSourceData Source:=Sheets(WShtName).Range( _
GBData.Address & "," & NonGBData.Address)
--
Regards,
Tom Ogilvy
"Ladymuck" wrote in message
...
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!
|