viernes, 21 de octubre de 2022

Combinació de valors de dues columnes ABCD... i abcd... resultant Aa Ab Ac Ad... Ba Bb Bc Bd... (Excel VBA) Alt+F11

 Sub Macro1()

Dim CantFilaCol1 As Long
Dim CantFilaCol2 As Long
Dim m As Single

CantFilaCol1 = Cells(Rows.Count, 1).End(xlUp).Row
CantFilaCol2 = Cells(Rows.Count, 2).End(xlUp).Row

m = CantFilaCol1 + 2

For fCol1 = 1 To CantFilaCol1 Step 1
    For fCol2 = 1 To CantFilaCol2 Step 1
        Cells(m, 1).Value = Cells(fCol1, 1).Value & " " & Cells(fCol2, 2).Value
        m = m + 1
    Next fCol2
Next fCol1

End Sub

No hay comentarios:

Publicar un comentario