How do I do this?

  • Thread starter Thread starter Mike Mike
  • Start date Start date
M

Mike Mike

I got column A and B

Column A Column B

banana red
orange green
apples blue
fish black


I need a third column with A1+each in column B, A2+each cell in column B
etc..
like this:

banana red
banana green
banana blue
banana black
orange red
orange green
orange blue
orange black
apples red
apples green etc..........

Regards
Mike
 
Sub Test()
Dim iLastRow As Long
Dim iLastRow2 As Long
Dim iRows As Long
Dim i As Long, j As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
iLastRow2 = Cells(Rows.Count, "B").End(xlUp).Row
For i = 1 To iLastRow
For j = 1 To iLastRow2
iRows = iRows + 1
Cells(iRows, "C").Value = Cells(i, "A") & " " & _
Cells(j, "B")
Next j
Next i

End Sub



--

HTH

RP
(remove nothere from the email address if mailing direct)
 
Back
Top