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
Tengo un problema en mi macro, ya que se ejecuta solamente al reescribir sobre la celda J23
Quisiera que se ejecute de manera automática al realizar un nuevo cálculo en la hoja, como podria solucionarlo?
Dejo mi código:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rango As String
Rango = "J23"
If Not Application.Intersect(Target, Range(Rango)) Is Nothing Then
For i = 1 To ActiveSheet.Shapes.Count
ActiveSheet.Shapes(i).Visible = True
Next i
For i = 1 To ActiveSheet.Shapes.Count
If ActiveSheet.Shapes(i).Name = Range("J23").Text Then
ActiveSheet.Shapes(i).Visible = False
Exit For
End If
Next i
End If