Convert a column into a comma separated list

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Convert a column into a comma separated list

Message par ForumBot »

Convert a column into a comma separated list
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Convert a column into a comma separated list

Message par ForumBot »

I actually just created a module in VBA which does all of the work. It takes my ranged list and creates a comma-delimited string which is output into the cell of my choice:

`Function csvRange(myRange As Range)
Dim csvRangeOutput
Dim entry as variant
For Each entry In myRange
If Not IsEmpty(entry.Value) Then
csvRangeOutput = csvRangeOutput & entry.Value & ","
End If
Next
csvRange = Left(csvRangeOutput, Len(csvRangeOutput) - 1)
End Function

```

So then in my cell, I just put `=csvRange(A:A)` and it gives me the comma-delimited list.
Répondre

Revenir à « Excel & VBA »