View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default Concatenate values

Hi

Try someting like this:

Sub ConcatenateCells()
Dim TargetRange As Range
Dim NotFirst As Boolean
Dim MyString As String

Set TargetRange = Selection
If TargetRange.Rows.Count 1 Then Exit Sub
For Each cell In TargetRange
If NotFirst Then
MyString = MyString & " " & cell.Value
Else
MyString = cell.Value
NotFirst = True
End If
Next
Range("L" & TargetRange.Row) = MyString
End Sub

Regards,
Per


On 13 Sep., 23:38, Mik wrote:
I wish to Concatenate a Range of values.
The range will always be a single row, from column A:K, however the
row number could vary.
So, the range will be highlighted / selected by the user.

How, using VBA, do i copy the selected range and Concatenate to a
single cell?
I would also like a "space" between each concatenated value.