View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dan R. Dan R. is offline
external usenet poster
 
Posts: 220
Default Concatenate Macro

Thanks a lot, that's exactly what I needed.

- Dan

Gary''s Student wrote:
Here is a simple function that concatentates a range of cells:

Function mergem(r As Range) As String
mergem = r.Cells(1, 1).Value
k = 1
For Each rr In r
If k < 1 Then
mergem = mergem & "," & rr.Value
End If
k = 2
Next
End Function
--
Gary's Student


"Dan R." wrote:

I have a list of values in Column A. In Column B - Row 1 I want to
concatenate the values from Column A - Rows 1-50 with commas in between
each value, and in Column B - Row 2 I want to concatenate the values
from rows 51-100 with commas in between. I'm using a ridiculously long
formula right now to do this.... =A1&","&A2&","&A3&","&A4&","&A5....
and on and on and on...

Can someone please help me write a macro to do this?

Thanks
- Dan