Have to repeat list

kashif.aali 1 Posts Tuesday May 16, 2017Registration date May 16, 2017 Last seen - May 16, 2017 at 02:17 AM - Latest reply: TrowaD 2340 Posts Sunday September 12, 2010Registration dateModeratorStatus April 19, 2018 Last seen
- May 16, 2017 at 11:12 AM
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
See more 

1 reply

Reply to this topic
TrowaD 2340 Posts Sunday September 12, 2010Registration dateModeratorStatus April 19, 2018 Last seen - May 16, 2017 at 11:12 AM
0
Helpful
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
Respond to TrowaD