ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Merge contents of cells and insert line space (https://www.excelbanter.com/excel-worksheet-functions/145888-merge-contents-cells-insert-line-space.html)

Craig

Merge contents of cells and insert line space
 
Hi,
I would like via a function (preferred) or macro, to combine several
adjacent cells into a single cell, but separate the contents with a line
space.

I am familiar with the concatenate function, but I am unsure how to insert a
line space between the contents of each cell. Any help much appreciated.
Craig

Max

Merge contents of cells and insert line space
 
One way

Assuming source text in A1:C1, then in D1:
=A1&CHAR(10)&B1&CHAR(10)&C1
Format D1 to wrap text. Copy down as required
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Craig" wrote:
Hi,
I would like via a function (preferred) or macro, to combine several
adjacent cells into a single cell, but separate the contents with a line
space.

I am familiar with the concatenate function, but I am unsure how to insert a
line space between the contents of each cell. Any help much appreciated.
Craig


Teethless mama

Merge contents of cells and insert line space
 
=CONCATENATE(A1," ",B1," ",C1)


"Craig" wrote:

Hi,
I would like via a function (preferred) or macro, to combine several
adjacent cells into a single cell, but separate the contents with a line
space.

I am familiar with the concatenate function, but I am unsure how to insert a
line space between the contents of each cell. Any help much appreciated.
Craig


Gord Dibben

Merge contents of cells and insert line space
 
Craig

What is a line space? A linefeed or just a space between words?

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 = Chr(10) 'for line feed
' w = InputBox("Enter the Type of De-limiter Desired") for your choice
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


Gord Dibben MS Excel MVP

On Fri, 8 Jun 2007 16:34:01 -0700, Craig
wrote:

Hi,
I would like via a function (preferred) or macro, to combine several
adjacent cells into a single cell, but separate the contents with a line
space.

I am familiar with the concatenate function, but I am unsure how to insert a
line space between the contents of each cell. Any help much appreciated.
Craig




All times are GMT +1. The time now is 12:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com