merging cells

crtas1

Board Regular
Joined
Jul 9, 2002
Messages
55
I am trying to merge 4 lines of text. I keep getting the error message "The selection contains multiple data values. Merging into one cell will keep the upper-most data only."

The text looks like the below each line in a different cell. I would like all four in one cell

we need the following
information blah
please return a claims
blah blah
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
On 2002-09-24 12:34, crtas1 wrote:
I am trying to merge 4 lines of text. I keep getting the error message "The selection contains multiple data values. Merging into one cell will keep the upper-most data only."

The text looks like the below each line in a different cell. I would like all four in one cell

we need the following
information blah
please return a claims
blah blah

=A1&CHAR(10)&A2&CHAR(10)&A3&CHAR(10)&A4

Wrap text using Format|Alignment.
 
Upvote 0
I am sorry I should have been more specific. I need the four cells to be merged vertically. I still want it to look the same just be one cell.
 
Upvote 0
1) Open the VB editor (Alt F11)
2) Hit Ctrl+R to ensure that the Project Explorer is visible
3) In there you should be able to see your workbook saying something like VBAProject (Workbookname.xls)
4) Double click on the Thisworkbook icon
5) The code module opens up
6) Paste this code into it:

Sub merge()
With ActiveCell
.Value = .Value & Chr(10) & .Offset(1) & Chr(10) & .Offset(2) & Chr(10) & .Offset(3)
.Offset(1).Clear
.Offset(2).Clear
.Offset(3).Clear
End With
End Sub

7) Select the cell containing "we need the following" (top cell)
:cool: Hit Alt+F8 to open the macro window and run Thisworkbook.merge
 
Upvote 0
I want to do the same thing, except I want the results to be the following:

Before:

Allen
is
really
cool

After:
Allen is really cool

I'd also want for the empty row to be deleted.
 
Upvote 0

Forum statistics

Threads
1,214,530
Messages
6,120,071
Members
448,943
Latest member
sharmarick

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