Macro crear gráfico según datos variados de una tabla
Necesito macro para crear el gráfico en una nueva hoja pero no se como recorrer la tabla con datos descontinuos, también los datos varían entre filas y columnas.
Macro grabado
Sub Makro3() ' ' Makro3 Makro ' ' Range("J11").Select ActiveSheet.Shapes.AddChart2(240, xlXYScatterSmooth).Select Application.CutCopyMode = False ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(1).Name = "=Blad1!$B$3" ActiveChart.FullSeriesCollection(1).XValues = "=Blad1!$B$4:$B$20" ActiveChart.FullSeriesCollection(1).Values = "=Blad1!$A$4:$A$20" ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(2).Name = "=Blad1!$C$3" ActiveChart.FullSeriesCollection(2).XValues = "=Blad1!$C$5:$C$20" ActiveChart.FullSeriesCollection(2).Values = "=Blad1!$A$5:$A$20" ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(3).Name = "=Blad1!$D$3" ActiveChart.FullSeriesCollection(3).XValues = "=Blad1!$D$7:$D$20" ActiveChart.FullSeriesCollection(3).Values = "=Blad1!$A$7:$A$20" ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(4).Name = "=Blad1!$E$3" ActiveChart.FullSeriesCollection(4).XValues = "=Blad1!$E$9:$E$20" ActiveChart.FullSeriesCollection(4).Values = "=Blad1!$A$9:$A$20" ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(5).Name = "=Blad1!$F$3" ActiveChart.FullSeriesCollection(5).XValues = "=Blad1!$F$11:$F$20" ActiveChart.FullSeriesCollection(5).Values = "=Blad1!$A$11:$A$20" ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(6).Name = "=Blad1!$G$3" ActiveChart.FullSeriesCollection(6).XValues = "=Blad1!$G$12:$G$20" ActiveChart.FullSeriesCollection(6).Values = "=Blad1!$A$12:$A$20" ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(7).Name = "=Blad1!$H$3" ActiveChart.FullSeriesCollection(7).XValues = "=Blad1!$H$14:$H$20" ActiveChart.FullSeriesCollection(7).Values = "=Blad1!$A$14:$A$20" ActiveChart.SeriesCollection.NewSeries ActiveChart.FullSeriesCollection(8).Name = "=Blad1!$I$3" ActiveChart.FullSeriesCollection(8).XValues = "=Blad1!$I$17:$I$20" ActiveChart.FullSeriesCollection(8).Values = "=Blad1!$A$17:$A$20" Range("I3").Select ActiveChart.PlotArea.Select ActiveChart.FullSeriesCollection(1).Select Range("J7").Select End Sub
comparto del archivo con ejemplos en 2 hojas
https://drive.google.com/file/d/1nLmFO0fVLNY1PN0q4p_Tfdya0NVtiq0c/view?usp=sharing
1 respuesta
Respuesta de Elsa Matilde
2