combine rows into one cell separated by comma

G

Guest

Need to combine 100 email addesses in separate rows (in Excel) into one cell,
separated by comma, so I can do mass mail. Formula I'm trying won't work.
 
G

Gord Dibben

Miki

Function ConCatRange(CellBlock As Range) As String
Dim cell As Range
Dim sbuf As String
For Each cell In CellBlock
If Len(cell.text) > 0 Then sbuf = sbuf & cell.text & ","
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

usage would be =ConCatRange(A1:A100)


Gord Dibben MS Excel MVP
 

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