Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default combine two ranges

If you delete all of your series, then you don't have a series to assign to.

If you are going to do that, you need to add a series. Easier would be to
keep the first series since you are assigning a new range to it.

Do While pieChart.SeriesCollection.Count 1
pieChart.SeriesCollection(1).Delete
Loop

--
Regards,
Tom Ogilvy

"rtos" wrote in message
om...
I am trying following code that combines two ranges and sets the
resulting range to values and XValues in a sereis. The part I am
having trouble is


With pieChart.SeriesCollection.NewSeries
.Name = "Portfolio Allocation"
.values = stockValues
.XValues = names
End With

Its complaining about setting .values to stockValues, Whats wrong
here?

Private Sub RefreshAllocationChart()
Dim pieChart As Chart

Set pieChart = Worksheets("Main").ChartObjects(1).Chart

Do While pieChart.SeriesCollection.Count < 0
pieChart.SeriesCollection(1).Delete
Loop

Dim names As Range
Dim values As Range

Set names = Range(Range("StockSymbols"), Range("Cash"))
Set stockValues = Range(Range("StockValues"), Range("CashValue"))

With pieChart.SeriesCollection.NewSeries
.Name = "Portfolio Allocation"
.values = stockValues
.XValues = names
End With
End Sub



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I combine worksheets w/o enough rows to combine? Amanda W. Excel Worksheet Functions 3 June 9th 09 07:26 AM
Combine multiple ranges into one worksheet Troy Man Excel Discussion (Misc queries) 1 September 30th 08 05:57 AM
Combine cells with the same reference and combine quantities brandon Excel Discussion (Misc queries) 2 September 17th 08 05:44 PM
Combine 2 ranges in different sheets using Pivot Table Jac Excel Discussion (Misc queries) 0 December 21st 06 08:03 AM
Combine ranges from 2 sheet into 3rd David Turner Excel Programming 1 July 24th 03 11:57 PM


All times are GMT +1. The time now is 02:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"