there's a concatenate function..
but the programmer must have had a bad pizza.. or a bad hair day..
it's argument is a paramarray.. and it will not process arrays or a
multiarea range. which would have been very usefull...
as it is there's no advantage over &
(and wouldnt it be nice if you could glue the text values of an entire
range into 1 cell?
Or try it with following udf
(DONOT put it in an object module (not in thisworkbook, not in
sheet1...)
Open VBE/Insert Module then copy/paste
OPTION EXPLICIT
Public Function GlueText( _
data As Variant, _
Optional delimiter As String = vbNullString) As String
Dim rArea, rCell, r&, c&, s$
If TypeOf data Is Range Then
For Each rArea In data.Areas
For Each rCell In rArea.Cells
'Note: for ranges the (formatted) Text property is used
If Len(rCell) Then s = s & delimiter & rCell.Text
Next
Next
ElseIf IsArray(data) Then
On Error Resume Next
c = LBound(data, 2) + 1
On Error GoTo 0
If c > 0 Then GoTo TwoDim Else GoTo OneDim
TwoDim:
For r = LBound(data, 1) To UBound(data, 1)
For c = LBound(data, 2) To UBound(data, 2)
If Len(data(r, c)) Then s = s & delimiter & data(r, c)
Next
Next
GoTo TheEnd
OneDim:
For r = LBound(data) To UBound(data)
If Len(data(r)) Then s = s & delimiter & data(r)
Next
Else
s = data
End If
TheEnd:
GlueText = Mid(s, 1 + Len(delimiter))
End Function
keepITcool
< email : keepitcool chello nl (with @ and .) >
< homepage:
http://members.chello.nl/keepitcool >