Have to repeat list [Closed]

Report
Posts
1
Registration date
Tuesday May 16, 2017
Status
Member
Last seen
May 16, 2017
-
Posts
2717
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
April 1, 2021
-
Dear all Please help out
have to repeat two list in one list.

Query:
List A List B
A 1
B 2
C 3
D


Results
List C
A 1
A 2
A 3
B 1
B 2
B 3

Thanks in advance

1 reply

Posts
2717
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
April 1, 2021
459
Hi Kashif.aali,

Give the following code a try:
Sub RunMe()
Dim x, y, z As Integer

x = 1
y = 1
z = 1

Do
    Cells(x, "C").Value = Cells(y, "A") & " " & Cells(z, "B")
    x = x + 1
    z = z + 1
    
    If z > 3 Then
        y = y + 1
        z = 1
    End If
    
Loop Until IsEmpty(Cells(y, "A"))
End Sub


Best regards,
Trowa

Subscribe To Our Newsletter!

The Best of CCM in Your Inbox

Subscribe To Our Newsletter!