How do I do this?

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top