martes, 31 de mayo de 2022

Matriu de m x n a una matriu de dues columnes on la primera és recursiva (resultat a partir de la columna 36 o AJ)

Sub taula()

Dim CantFila As Long
Dim CantCol As Long
Dim c As Single, f As Single, M As Single
M = 1

CantFila = Cells(Rows.Count, 1).End(xlUp).Row
CantCol = Cells(1, Columns.Count).End(xlToLeft).Column

    
For c = 2 To CantCol Step 1
    For f = 2 To CantFila Step 1

        Cells(M, 31).Value = Cells(f, 1).Value
        Cells(M, 32).Value = Cells(1, c).Value
        Cells(M, 33).Value = Cells(f, c).Value
        M = M + 1

    Next f
Next c

End Sub


No hay comentarios:

Publicar un comentario