View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
OssieMac OssieMac is offline
external usenet poster
 
Posts: 2,510
Default How to concatenate D1:D64?

Hi Joe,

I don't think you will find a formula. However, did you create your code as
a User Defined Function (UDF)? Following is an example FYI and anyone else
who is looking for same solution.

Note: A space and underscore at the end of a line is a line break in an
otherwise single line of code.

Function ConCatRng(ByVal rngTarget As Range, _
Optional strSeparator As String)

Application.Volatile

Dim rng As Range

For Each rng In rngTarget
ConCatRng = ConCatRng & rng.Value _
& strSeparator
Next rng

'Remove the trailing separator (if any)
ConCatRng = Left(ConCatRng, _
Len(ConCatRng) - Len(strSeparator))

End Function

Separator is optional. Default is no separator.
Enter function like following for space separators.
=ConCatRng(A1:A25," ")

Enter function like following for no separator.
=ConCatRng(A1:A25)


--
Regards,

OssieMac