#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
walan
 
Posts: n/a
Default Merge Row Data


Does anyone have a simple way of merging row data into one cell with a
comma or line separator?
4565 4565|5123|212|213 etc
5123
212
213
2112
2121
21212
221

Any clever ideas are welcome that would function on the fly for lots of
rows of data.

Thank you


--
walan
------------------------------------------------------------------------
walan's Profile: http://www.excelforum.com/member.php...o&userid=13528
View this thread: http://www.excelforum.com/showthread...hreadid=496071

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gord Dibben
 
Posts: n/a
Default Merge Row Data

Walan

Sub ConCat_Cells()
Dim x As Range
Dim y As Range
Dim z As Range
Dim w As String
Dim sbuf As String
On Error GoTo endit
w = InputBox("Enter the Type of De-limiter Desired")
Set z = Application.InputBox("Select Destination Cell", _
"Destination Cell", , , , , , 8)
Application.SendKeys "+{F8}"
Set x = Application.InputBox _
("Select Cells...Contiguous or Non-Contiguous", _
"Cells Selection", , , , , , 8)
For Each y In x
If Len(y.text) 0 Then sbuf = sbuf & y.text & w
Next
z = Left(sbuf, Len(sbuf) - 1)
Exit Sub
endit:
MsgBox "Nothing Selected. Please try again."
End Sub

Alternative.............UDF

Function ConCatRange(CellBlock As Range) As String
Dim Cell As Range
Dim sbuf As String
For Each Cell In CellBlock
If Len(Cell.text) 0 Then sbuf = sbuf & Cell.text & ","
Next
ConCatRange = Left(sbuf, Len(sbuf) - 1)
End Function

=ConCatRange(A1:A15)


Gord Dibben Excel MVP


On Mon, 26 Dec 2005 16:07:44 -0600, walan
wrote:


Does anyone have a simple way of merging row data into one cell with a
comma or line separator?
4565 4565|5123|212|213 etc
5123
212
213
2112
2121
21212
221

Any clever ideas are welcome that would function on the fly for lots of
rows of data.

Thank you

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
walan
 
Posts: n/a
Default Merge Row Data


Dibben,
This does the trick, you are the best MVP. Thank you.


--
walan
------------------------------------------------------------------------
walan's Profile: http://www.excelforum.com/member.php...o&userid=13528
View this thread: http://www.excelforum.com/showthread...hreadid=496071

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
Excel Macro to Copy & Paste [email protected] Excel Worksheet Functions 0 December 1st 05 01:56 PM
From several workbooks onto one excel worksheet steve Excel Discussion (Misc queries) 6 December 1st 05 08:03 AM
how do i get my mail merge to update the data source at each merge Steel_Monkey Excel Discussion (Misc queries) 0 November 30th 05 08:41 AM
merge multiple row cells of text corresponding to one row of data roberta t williams Excel Worksheet Functions 0 August 12th 05 04:09 PM
To safety merge cells without data destroyed, and smart unmerge! Kevin Excel Discussion (Misc queries) 0 December 30th 04 07:17 AM


All times are GMT +1. The time now is 08:47 PM.

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"