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

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
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.
 

crtas1

Board Regular
Joined
Jul 9, 2002
Messages
55
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.
 

rikrak

Active Member
Joined
Aug 21, 2002
Messages
255
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
 

allen121

Board Regular
Joined
May 7, 2003
Messages
60
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.
 

Forum statistics

Threads
1,144,770
Messages
5,726,187
Members
422,661
Latest member
foxleinlady

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
Top