ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Unable to set the XValues Property (https://www.excelbanter.com/charts-charting-excel/44794-unable-set-xvalues-property.html)

Ali Baba

Unable to set the XValues Property
 
I am getting a run -time error 1004 stating it is unable to set the XValues
Property of the Series Class. I don't know why!!!

I did some changes to the old code which was running fine but this code is
annoying me .

Can anybody help plz

Sub SelectCapacity()
Sheets("Numerical Integration").ChartObjects("ChartNumInteg").Activa te
ActiveChart.PlotArea.Select
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers


Select Case CapacityCombo.Value
Case "Exponential"
With ActiveChart
.SeriesCollection(1).XValues = "=AnalysisPageNI!R4C1:R100C1"
.SeriesCollection(1).Values = "=AnalysisPageNI!R4C2:R100C2"
.SeriesCollection(1).Name = "Capacity"
End With

Case "Gumbel"
With ActiveChart
.SeriesCollection(1).XValues = "=AnalysisPageNI!R4C1:R100C1"
.SeriesCollection(1).Values = "=AnalysisPageNI!R4C3:R100C3"
.SeriesCollection(1).Name = "Capacity"
End With
End select

End Sub

Tushar Mehta

A good way to do some diagnostic work is to start by figuring out which
line generates the error. Also, compare the old code and the new.
What were the changes?

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...
I am getting a run -time error 1004 stating it is unable to set the XValues
Property of the Series Class. I don't know why!!!

I did some changes to the old code which was running fine but this code is
annoying me .

Can anybody help plz

Sub SelectCapacity()
Sheets("Numerical Integration").ChartObjects("ChartNumInteg").Activa te
ActiveChart.PlotArea.Select
ActiveChart.ChartType = xlXYScatterSmoothNoMarkers


Select Case CapacityCombo.Value
Case "Exponential"
With ActiveChart
.SeriesCollection(1).XValues = "=AnalysisPageNI!R4C1:R100C1"
.SeriesCollection(1).Values = "=AnalysisPageNI!R4C2:R100C2"
.SeriesCollection(1).Name = "Capacity"
End With

Case "Gumbel"
With ActiveChart
.SeriesCollection(1).XValues = "=AnalysisPageNI!R4C1:R100C1"
.SeriesCollection(1).Values = "=AnalysisPageNI!R4C3:R100C3"
.SeriesCollection(1).Name = "Capacity"
End With
End select

End Sub


Jon Peltier

Also make sure that the sheet and cell references in the range are correct, and that
the range contains legitimate charting data.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Tushar Mehta wrote:

A good way to do some diagnostic work is to start by figuring out which
line generates the error. Also, compare the old code and the new.
What were the changes?




All times are GMT +1. The time now is 12:18 PM.

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