PC Review


Reply
Thread Tools Rate Thread

Concatenate cells from M9 to Last row in M

 
 
BEEJAY
Guest
Posts: n/a
 
      25th Feb 2010
Greetings:
Have variable length of cells in column M, to be concatenated and entered in
C (3 rows below last row).

Trying:

Range("C:C" & LastRow + 3) ' Cell to receive concatenated result

Then need something like:

=Concatenate(M9&M10&M11 etc - to last row.

Column M already contains the data with required commas and spaces inserted,
ready to do the required searches in an "in house" program.

Thank you
 
Reply With Quote
 
 
 
 
Paul Robinson
Guest
Posts: n/a
 
      25th Feb 2010
Hi
WrapIt can be called within another sub or used in a worksheet.
rng can be any range object e.g.
set rng = Range("M3:M30")
set rng = Selection
set rng = Range("M3").CurrentRegion

and many others. See Excel VBA (Greene et al) or some such book for a
full discussion of range.


Public Function WrapIt(rng As Range) As String
Dim myCell As Range
Dim Temp As String
Temp = ""
For Each myCell In rng
Temp = Temp & CStr(myCell)
Next myCell
WrapIt = Temp
End Function

regards
Paul

On Feb 25, 4:31*pm, BEEJAY <BEE...@discussions.microsoft.com> wrote:
> Greetings:
> Have variable length of cells in column M, to be concatenated and enteredin
> C (3 rows below last row).
>
> Trying:
>
> Range("C:C" & LastRow + 3) * ' Cell to receive concatenated result
>
> Then need something like:
>
> =Concatenate(M9&M10&M11 etc *- to last row.
>
> Column M already contains the data with required commas and spaces inserted,
> ready to do the required searches in an "in house" program.
>
> Thank you


 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      25th Feb 2010
Give this macro a try...

Sub CombineColumnM()
Dim LastRowC As Long, LastRowM As Long
LastRowC = Cells(Rows.Count, "C").End(xlUp).Row
LastRowM = Cells(Rows.Count, "M").End(xlUp).Row
Cells(LastRowC + 3, "C").Value = Join(WorksheetFunction.Transpose( _
Range("M9:M" & LastRowM)), "")
End Sub

--
Rick (MVP - Excel)


"BEEJAY" <(E-Mail Removed)> wrote in message
newsE5C46B0-5B3D-4257-8F17-(E-Mail Removed)...
> Greetings:
> Have variable length of cells in column M, to be concatenated and entered
> in
> C (3 rows below last row).
>
> Trying:
>
> Range("C:C" & LastRow + 3) ' Cell to receive concatenated result
>
> Then need something like:
>
> =Concatenate(M9&M10&M11 etc - to last row.
>
> Column M already contains the data with required commas and spaces
> inserted,
> ready to do the required searches in an "in house" program.
>
> Thank you


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate Cells peterh Microsoft Excel Worksheet Functions 5 16th Dec 2009 07:05 AM
Concatenate many cells art Microsoft Excel Worksheet Functions 0 19th May 2009 02:31 AM
how do I UN-concatenate cells =?Utf-8?B?anVsaWE=?= Microsoft Excel Misc 2 5th Jan 2005 07:45 PM
Re: Concatenate cells susan hayes Microsoft Excel Worksheet Functions 2 20th Oct 2004 09:53 PM
concatenate 30+ cells Mathias Microsoft Excel Worksheet Functions 7 28th Jun 2004 08:49 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:23 AM.