PDA

View Full Version : runtime error 1004



zero80
04-04-2008, 12:26 PM
hi, my macro run with error (runtime error 1004)

ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(1).Values = "='Detalle Diario'!R" & x & "C9:R" & y & "C9"
ActiveChart.SeriesCollection(2).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(2).Values = "='Detalle Diario'!R" & x & "C10:R" & y & "C10"
ActiveChart.SeriesCollection(3).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(3).Values = "='Detalle Diario'!R" & x & "C12:R" & y & "C12"
ActiveChart.SeriesCollection(4).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(4).Values = "='Detalle Diario'!R" & x & "C3:R" & y & "C3"
ActiveChart.SeriesCollection(5).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(5).Values = "='Detalle Diario'!R" & x & "C4:R" & y & "C4"
ActiveChart.SeriesCollection(6).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(6).Values = "='Detalle Diario'!R" & x & "C5:R" & y & "C5"
ActiveChart.SeriesCollection(7).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(7).Values = "='Detalle Diario'!R" & x & "C6:R" & y & "C6"
ActiveChart.SeriesCollection(8).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(8).Values = "='Detalle Diario'!R" & x & "C7:R" & y & "C7"


the error is this line

ActiveChart.SeriesCollection(8).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"

the order series work correctly

why is the error??

regards

figment
04-04-2008, 02:24 PM
what are the values of X and Y at the time of the error?

tstav
04-04-2008, 02:35 PM
Would you replicate the error and post back the full error message?
"Error 1004" is too vague.
Does it say anything about a missing object?
Do you have a SeriesCollection(8)?
What is it saying?

rory
04-04-2008, 04:22 PM
If you currently have a seriescollection(8), does it currently have valid values and display on the chart?

Aussiebear
04-04-2008, 09:47 PM
I have to admit that when I first read this, I thought that the series 8 data did not exist...

zero80
04-07-2008, 06:49 AM
what are the values of X and Y at the time of the error?

x = 334
y = 363

that no is the problem

zero80
04-07-2008, 06:52 AM
Would you replicate the error and post back the full error message?
"Error 1004" is too vague.
Does it say anything about a missing object?
Do you have a SeriesCollection(8)?
What is it saying?

the full error message

Run-time error '1004'
Unable to set XValues property of the Series class

zero80
04-07-2008, 06:54 AM
the full code of my macro, I copy a graph and change the series

ActiveWindow.Visible = False
Windows("Prueba auto Estado diario de tickets.xls").Activate
Sheets("Tickets-Def-Marzo2008").Select
Sheets("Tickets-Def-Marzo2008").Copy Before:=Sheets(25)
Sheets("Tickets-Def-Marzo2008 (2)").Select
Sheets("Tickets-Def-Marzo2008 (2)").Name = "Tickets-Def-Abril2008"
Sheets("Detalle Diario").Select
ActiveWindow.SmallScroll Down:=48

x = 334
y = 363

Sheets("Tickets-Def-Abril2008").Select



ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection(1).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(1).Values = "='Detalle Diario'!R" & x & "C9:R" & y & "C9"
ActiveChart.SeriesCollection(2).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(2).Values = "='Detalle Diario'!R" & x & "C10:R" & y & "C10"
ActiveChart.SeriesCollection(3).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(3).Values = "='Detalle Diario'!R" & x & "C12:R" & y & "C12"
ActiveChart.SeriesCollection(4).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(4).Values = "='Detalle Diario'!R" & x & "C3:R" & y & "C3"
ActiveChart.SeriesCollection(5).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(5).Values = "='Detalle Diario'!R" & x & "C4:R" & y & "C4"
ActiveChart.SeriesCollection(6).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(6).Values = "='Detalle Diario'!R" & x & "C5:R" & y & "C5"
ActiveChart.SeriesCollection(7).XValues = "='Detalle Diario'!R" & x & "C1:R" & y & "C1"
ActiveChart.SeriesCollection(7).Values = "='Detalle Diario'!R" & x & "C6:R" & y & "C6"
ActiveChart.SeriesCollection(8).XValues = "='Detalle Diario'!R734C1:R763C1"
ActiveChart.SeriesCollection(8).Values = "='Detalle Diario'!R734C7:R763C7"

End Sub

rory
04-07-2008, 07:00 AM
Are there currently values for series 8 and does it display on the chart?