Convert rows to cell seperated by commas

/Convert rows to cell seperated by commas

Convert rows to cell seperated by commas

You need to add a custom function in Excel. You can add using the edit macro option in excel. Then use the below code in the macro window.

Function ConCatRange(C1 As Integer) As String
Dim CellBlock As Range
‘CellBlock = x1: x2
Dim cell As Range
Dim sbuf As String
‘CellBlock = CellBlocks
Set CellBlock = Range(“A” & C1 & “:A” & C1 + 23)
For Each cell In CellBlock
If Len(cell.Text) > 0 Then sbuf = sbuf & cell.Text & “,”
Next
ConCatRange = Left(sbuf, Len(sbuf) – 1)
End Function

Then you can use this function in the cell where you want to change the row data in cell seperated by comma.

By | 2010-11-16T14:46:17+00:00 November 16th, 2010|Excel, Uncategorized|Comments Off on Convert rows to cell seperated by commas