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
Mi Macros transforma datos del Excel a txt separando las columnas por un palote, mi problema es que transfiere también la información de filas vacías agregando los palotes hasta el infinito.
Sub CreaTxT()
Dim NombreArchivo, RutaArchivo As String
Dim obj As FileSystemObject
Dim tx As Scripting.TextStream
Dim ht As Worksheet
Dim i, j, nfilas, ncolumnas As Integer
NombreArchivo = "LE" & Cells(2, 4).Value & Cells(3, 4) & "0008010000" & Cells(4, 5) & Cells(5, 5) & Cells(6, 5) & "1"
RutaArchivo = ActiveWorkbook.Path & "\" & NombreArchivo & ".txt"
Set obj = New FileSystemObject
Set tx = obj.CreateTextFile(RutaArchivo)
Set ht = Worksheets("REGISTRO FINAL")
nfilas = ht.Range("a6", ht.Range("a6").End(xlDown)).Cells.Count
ncolumnas = ht.Range("a5", ht.Range("a5").End(xlToRight)).Cells.Count
For i = 5 To nfilas
For j = 1 To ncolumnas
tx.Write ht.Cells(i + 1, j)
If j < ncolumnas Then tx.Write "|"
Next j
tx.WriteLine
Next i
tx.Close