Qete_ARG
Board Regular
- Joined
- Oct 20, 2005
- Messages
- 72
Hello everyone...I am trying to fix this since yesterday but I am running out of time, so I hope someone can help me.
I am creating a Chart from VBA, adding series as needed. The series are not in a continous range, but in separate ranges (all of them are "n" rows by 1 column).
In the line bolded in the code below I get an error. But if I comment out that line and after the chart is created I manually change the design of the chart (change between rows and columns) I can do it. I recorded a macro with this step and that is what tryed to apply, but with no luck.
Can anyone give me some advice?
Really appreciated for your time!
Miguel.
I am creating a Chart from VBA, adding series as needed. The series are not in a continous range, but in separate ranges (all of them are "n" rows by 1 column).
In the line bolded in the code below I get an error. But if I comment out that line and after the chart is created I manually change the design of the chart (change between rows and columns) I can do it. I recorded a macro with this step and that is what tryed to apply, but with no luck.
Can anyone give me some advice?
Really appreciated for your time!
Miguel.
Rich (BB code):
Set myChtObj = ActiveSheet.ChartObjects.Add _
(Left:=250, Width:=375, Top:=75, Height:=225)
With myChtObj.Chart
.ChartType = xlColumnClustered
Do Until .SeriesCollection.Count = 0
.SeriesCollection(1).Delete
Loop
For i = 0 To ListBox1.ListCount
For j = 0 To UBound(arrClientesSeleccionados)
If Sheets("Comparativos").Range("InicioReporte").Offset(0, i).Value = arrClientesSeleccionados(j) Then
With .SeriesCollection.NewSeries
.Values = Range(Sheets("Comparativos").Range("InicioReporte").Offset(0, i), Sheets("Comparativos").Range("InicioReporte").Offset(0, i).End(xlDown))
.XValues = Range(Sheets("Comparativos").Range("InicioFechasDelReporte").Offset(0, 0), Sheets("Comparativos").Range("InicioFechasDelReporte").Offset(0, 0).End(xlDown).End(xlDown))
.Name = Sheets("Comparativos").Range("InicioReporte").Offset(0, i).Value
End With
End If
Next j
Next i
.PlotBy = xlRows <--Here is where I get an error (Error in method 'PlotBy' of the '_Chart' object
End With