ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   updating charts (https://www.excelbanter.com/excel-programming/307597-re-updating-charts.html)

Chip Pearson

updating charts
 
Maynard,

You need to set the Rng variable to the range in which you want
to place the Values of the ChtSeries. E.g.,

Set Rng = Worksheets(1).Range("F1:K1")
Rng = ChtSeries.Values


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"Maynard" wrote in message
...
I'm attempting to set up a function that will update a chart

based on
allowing the user to select which sheet the data is on. There

are several
series on each chart, so I'm trying to avoid using named

ranges. I can't
seem to figure out why this isn't working. I get "object

variable or with
block variable not set" error on the specified line. Thanks

for any help!
PS - strShtName is entered on a UserForm.

Dim Rng As Range
Dim Cht As Chart
Dim ChtSeries As Series

For Each Cht In ThisWorkbook.Charts
For Each ChtSeries In Cht.SeriesCollection
Rng = ChtSeries.Values 'ERROR ON THIS

LINE!
Rng.Parent.Name = strShtName
Rng = ChtSeries.XValues
Rng.Parent.Name = strShtName
Set Rng = Nothing
Next ChtSeries
Next Cht





All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com