(Solved) – Why I could not get a full result with VBA for-loop

  • by
(solved)-–-why-i-could-not-get-a-full-result-with-vba-for-loop

enter image description here

In the excel file as above, I want each words in the Column one (12 totally) and each words in the Column two (4 totally) to be combined into phrases generated in the Column three. I should get 12*4 = 48 phrases. Using the codes I wrote as below, only less than 30 are there with some null-value cells. Please tell me why I couldn’t reach 48. Thank you.

Sub WordsCombiner()
    For i = 1 To 12
        For m = 1 To 4
            Cells(i * m, 3).Value = Cells(i, 1).Value   Cells(m, 2).Value
        Next
    Next
End Sub

The following is the original words:

(Column one)

from
the 
on 
this 
Oh
and 
FYI 
prices 
accurate 
and 
items 
in 

Column Two

as 
time 
of 
publication

Leave a Reply

Your email address will not be published. Required fields are marked *