Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Concatenation

And one more way...
'-------------------------------------------------------
'Loads an array with the text values from the selection.
'Uses the Join function to concatenate the array elements.
'Assigns the joined values to the A1 cell.
'Note: the Join function is available only in recent versions of XL.
'Jim Cone - 10/30/2004

Sub PutItTogether()
Dim rngSelect As Range
Dim rngCell As Range
Dim N As Long
Dim lngCount As Long
Dim arrText() As String

If TypeName(Selection) = "Range" Then
Set rngSelect = Selection
lngCount = WorksheetFunction.CountA(rngSelect)

If lngCount 0 Then
ReDim arrText(1 To lngCount)
For Each rngCell In rngSelect
If Len(rngCell.Text) Then
N = N + 1
arrText(N) = rngCell.Text
End If
Next 'N
Range("A1").Value = Join(arrText)
End If
End If

End Sub
'-------------------------------------------------------
Jim Cone
San Francisco, CA


"Tony" wrote in message ...
Is there a way to concatenate contiguous text cells without using multiple
*&*s
For numeric values I can do *=SUM(A1.H1)* , but how do I create a text
string using all the characters of text in A1.H1?
TIA
Tony


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenation Nanapat Excel Discussion (Misc queries) 4 December 13th 08 01:47 PM
Concatenation MichaelS Excel Discussion (Misc queries) 8 September 11th 08 07:54 AM
Concatenation JPS Excel Worksheet Functions 3 May 4th 08 07:35 AM
Concatenation orquidea Excel Discussion (Misc queries) 6 January 11th 08 07:19 PM
Concatenation Ken Excel Discussion (Misc queries) 1 April 12th 06 11:26 AM


All times are GMT +1. The time now is 05:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"