combine cells into one.

erodjob

Active Member
Joined
Feb 11, 2003
Messages
253
I have cells 1:6970 with data in each cell. How can I combine all values in cells 1:6970 into cell B1?

I use excel 2003.

Thank you
 
I have this code already and I use it within an access application referencing a table and it sends out email on by one. I want a mass email for this project. I need something like "=CONCATENATE(A1:A6970) I dont mind A1:A100 either but it does not seem to work unless i use "=CONCATENATE(A1,A2,A3,A4,A5,A6,A7)" etc. Any thoughts?
 
Upvote 0
How 'bout ol' Harlan's ACONCAT:
Code:
Function AConcat(varA As Variant, Optional strSep As String = "") As String
'¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
' by Harlan Grove, March 2002
    Dim varY As Variant
    If TypeOf varA Is Range Then
        For Each varY In varA.Cells
            AConcat = AConcat & varY.Value & strSep
        Next varY
    ElseIf IsArray(varA) Then
        For Each varY In varA
            AConcat = AConcat & varY & strSep
        Next varY
    Else
        AConcat = AConcat & varA & strSep
    End If
    AConcat = Left(AConcat, Len(AConcat) - Len(strSep))
End Function

You could then do:<ul>[*]=aconcat(A1:A100,", ")[/list]
 
Upvote 0
You can't use it that way, that function only takes thirty (30) arguments. Have you tried the code???
 
Upvote 0
Post-sequence problem, Zack? I assume you meant erodjob and not me...'cause Harlan's'll work (leastways it did on 400 cells, which is all I tested).
 
Upvote 0
Even stringing them together without a function works, but has it's limits. Granted it's freakin huge limit (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vagrpDataType.asp) but it still has a limit. Personally I think Harlan's code would be quite a bit over the edge as we know exactly what we're dealing with and don't need such a large "blanket".

So that would give two distinctly possible methods right off the bat, 1) loop through the range assigning values to a variable then use the variable to populate the To box, or 2) loop through the range appending the To box itself with each value.
 
Upvote 0
np, Zack. It just sounded like erod already had some code and just needed the concat bit to get him over the hump. Since I already had Harlan's code in my bag of tricks, figured just *bam* pop it in dere and we're off to the races.
 
Upvote 0

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top