Report

Have to repeat list

Ask a question kashif.aali 1Posts Tuesday May 16, 2017Registration date May 16, 2017 Last seen - Last answered on May 16, 2017 at 11:12 AM by TrowaD
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 
Helpful
+0
plus moins
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
Leave a comment

Member requests are more likely to be responded to.

Members can monitor the statuses of their requests from their account pages.

A CCM membership gives you access to additional options.

Not a member yet?

Sign up now. It takes less than a minute and is completely free!