View Full Version : Concatenate ever other row


Anthony George
11-18-2008, 09:44 PM
Hi Everyone

I wonder if anyone can help with this

I have a spreadsheet where in just column A on the first row there is an address. On row 2 there is a phone number.

This situation goes down the column for a thousand addresses and phone numbers. What I would like to do is to join each phone number on to the end of each address and display the concatenated result in an adjacent column.

I have tried several ways, but as I replicate down the page things seem to get out of step and I get addresses joined to addresses etc.

Thanks for any help

Kindest regards

Tony

chergh
11-18-2008, 11:28 PM
Try:


sub blah()

dim wb as workbook
dim ws as worksheet

set wb = thisworkbook
set ws = wb.worksheets("SheetName")

for i = 1 to ws.range("A65536").end(xlup).row step 2
ws.range("B" & i).value = ws.range("A" & i).value & ws.range("A" & i + 1).value
next i

end sub

qafself
11-18-2008, 11:36 PM
Hi Tony,

You can do this by formula

e.g.

in B1
=A1&" "&A2

Leave B2 blank

In B3=A3&" "&A4

leave B4 Blank

Now select B1 to B4

Copy down as far as you need

Anthony George
11-19-2008, 10:50 AM
Hi Chergh and Ed

Thank's for both solutions, it is really appreciated

All the best

Kindest Regards

Tony