Macro concatenate formula

V

vipjun

Hi everyone,

Im sure we all know that concatenate can be a really pain in the butt
function when you have alot of cells to concatenate and also theres a
30 cell limit.

so how would one concatenate
Column A
texta
textb
textc
textd

to

Column A
texta|textb|textc|textd

There would probably be a loop function until it finds a blank cell on
that column then it would stop. Also some columns might have more than
30cells. I have not created any macro's on excel so this would be my
first example to learn from

Thank you all,
vipjun
 
B

Bob Phillips

Sub Test()
Dim iLastRow As Long
Dim i As Long

iLastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = iLastRow To 2 Step -1
Cells(i - 1, "A").Value = Cells(i - 1, "A").Value & "|" & _
Cells(i, "A").Value
Cells(i, "A").Clear
Next i

End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail 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