concatenate 500 cells

K

Ken Wright

One way, and assuming you wanted commas in between each record :-

If A1 is part of your range, just put another one in that isn't.

Sub Concat()
Dim i As String
i = "'"
j = Selection.Cells.Count
k = 0

For Each cell In Selection
k = k + 1
If k < j Then
i = i & cell & ","
Else
i = i & cell
End If
Next cell

Range("A1").Value = i
End Sub
 

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