Así lo he hecho, he aceptado la segunda columna de anotación y he añadido una macro: Private Sub Worksheet_Calculate() Dim f As Long Dim disparar As Boolean ' Si ya se disparó una vez, salimos If Me.Range("XX2").Value <> "" Then Exit Sub ' Comprobamos si alguna W llegó a 2 For f = 2 To 6 If Me.Cells(f, "W").Value = 2 Then disparar = True Exit For End If Next f ' Si ninguna llegó a 2, no hacemos nada If disparar = False Then Exit Sub ' Guardamos TODO el rango como base For f = 2 To 6 Me.Cells(f, "XX").Value = Me.Cells(f, "W").Value ' Fórmula en Y restando su base Me.Cells(f, "Y").FormulaLocal = _ "=CONTAR.SI.CONJUNTO(Datos!B:B;$V$1;Datos!D:D;$V" & f & ")" & _ "-CONTAR.SI.CONJUNTO(Datos!B:B;$V$1;Datos!E:E;$V" & f & ")" & _ "-XX" & f Next f End Sub No es la opción más bonita porque sigue contando los objetos en la columna W, pero la función me resulta suficiente para poder llevar la cuenta. Tendré que hacer una pequeña macro para cada jugadora, son 14, pero espero no tener problemas
Por
Maku , · publicado el 25 de enero 25 ene
Hola,
El problema es el siguiente:
Si hago el gráfico como a continuación me funciona:
i = 0
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("DC").Range("H15000")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=DC!R1C3:R168C4"
ActiveChart.SeriesCollection(1).Values = "=DC!R1C5:R168C5"
ActiveChart.SeriesCollection(1).Name = "=""DISOLVENTE CONSUMIDO"""
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "DISOLVENTE CONSUMIDO"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "HORAS"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "KG"
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.HasLegend = False
ActiveChart.PlotArea.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
ActiveChart.ChartArea.Select
ActiveChart.Axes(xlCategory).Select
With Selection.Border
.Weight = xlHairline
.LineStyle = xlAutomatic
End With
With Selection
.MajorTickMark = xlNone
.MinorTickMark = xlNone
.TickLabelPosition = xlNextToAxis
End With
ActiveChart.ChartArea.Select
Pero si quiero que los datos con que quiero hacer las gráficas sean variables (como a continuación) tengo un problema en el código que no se como solventar:
i = 0
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Sheets("DC").Range("H15000")
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).XValues = "=DC!R(1+168*i)C3:R(168+168*i)C4"
ActiveChart.SeriesCollection(1).Values = "=DC!R(1+168*i)C5:R(168+168*i)C5"
ActiveChart.SeriesCollection(1).Name = "=""DISOLVENTE CONSUMIDO"""
ActiveChart.Location Where:=xlLocationAsNewSheet
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = "DISOLVENTE CONSUMIDO"
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "HORAS"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "KG"
End With
With ActiveChart.Axes(xlCategory)
.HasMajorGridlines = False
.HasMinorGridlines = False
End With
With ActiveChart.Axes(xlValue)
.HasMajorGridlines = True
.HasMinorGridlines = False
End With
ActiveChart.HasLegend = False
ActiveChart.PlotArea.Select
With Selection.Border
.Weight = xlThin
.LineStyle = xlNone
End With
With Selection.Interior
.ColorIndex = 2
.PatternColorIndex = 1
.Pattern = xlSolid
End With
ActiveChart.ChartArea.Select
ActiveChart.Axes(xlCategory).Select
With Selection.Border
.Weight = xlHairline
.LineStyle = xlAutomatic
End With
With Selection
.MajorTickMark = xlNone
.MinorTickMark = xlNone
.TickLabelPosition = xlNextToAxis
End With
ActiveChart.ChartArea.Select
Les agradecería mucho que me ayudasen con este problema, gracias.