How to merge cells (combine cells contents) in Excel without losing data?

We may combine cells and their contents in Microsoft Excel frequently. However, do you find out the easiest way to combine cell contents? Here we will talk about how to combine cell contents in Excel easily and quickly.

Combine multiple cells into one cell with VBA code

Combine multiple cells into one cell with Kutools for Excel without losing data


Combine multiple cells into one cell with VBA code


The following VBA code can help you to combine multiple cells into one cell, and you can apply the code with following steps:

1. Click Developer > Visual Basic, a new Microsoft Visual Basic for applications window will be displayed, click Insert > Module, and input the following code into the Module:

Sub MergeOneCell()
'Updateby20140128
Dim Rng As Range
Dim WorkRng As Range
Dim Sigh As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
Sigh = Application.InputBox("Symbol merge", xTitleId, "", Type:=2)
xOut = ""
Application.DisplayAlerts = False
For Each Rng In WorkRng
    xOut = xOut & Rng.Value & Sigh
Next
With WorkRng
    .Merge
    .Value = VBA.Left(xOut, VBA.Len(xOut) - 1)
End With
Application.DisplayAlerts = True
End Sub

2. Then click doc-multiply-calculation-3 button to execute the code. A dialog pops up for you to select a range to work with the VBA. See screenshots:

doc combine cell contents 1

3. Click Ok, another dialog is displayed for you to specify the seperator. See screenshot:

doc combine cell contents 2

4. Click Ok, then the cell contents in the selected range are combined into a cell. See screenshot:

doc combine cell contents 3


Combine multiple cells into one cell with Kutools for Excel without losing data

If you have Kutools for Excel installed, you can combine cell contents of multiple columns or rows conveniently without using formulas.

Kutools for Excel : with more than 120 handy Excel add-ins, free to try with no limitation in 60 days. 

1. Select the cells that you want to merge the data. And apply this utility by clicking Kutools > Combine.

doc combine cell contents 4

2. In the Combine Columns or Rows dialog box, specify the options that you need. See screenshot:

  • (1.) Select Combine into single cell under To combine selected cells according to following options;
  • (2.) Specify a separator for the combined data. You can separated each content with space, nothing, semicolon, or specific text. And you can also display the combined content in a new line.

doc combine cell contents 5

3. Then click OK or Apply, all of the data in multiple cells have been merged into one cell. See screenshot:

doc combine cell contents 6

The Combine feature of Kutools for Excel can be much more helpful. Know more about the Combine feature ...

Download and free trial Kutools for Excel Now !


Related Articles

How to Merge Columns without Losing Data in Excel?

How to Merge Rows without Losing Data in Excel?


Demo: Combine / Merge multiple cells into one without losing data

Kutools for Excel: with more than 200 handy Excel add-ins, free to try with no limitation in 60 days. Download and free trial Now!


Recommended Productivity Tools

Office Tab

gold star1 Bring handy tabs to Excel and other Office software, just like Chrome, Firefox and new Internet Explorer.

Kutools for Excel

gold star1Amazing! Increase your productivity in 5 minutes. Don't need any special skills, save two hours every day!

gold star1200 New Features for Excel, Make Excel Much Easy and Powerful:

  • Merge Cell/Rows/Columns without Losing Data.
  • Combine and Consolidate Multiple Sheets and Workbooks.
  • Compare Ranges, Copy Multiple Ranges, Convert Text to Date, Unit and Currency Conversion.
  • Count by Colors, Paging Subtotals, Advanced Sort and Super Filter,
  • More Select/Insert/Delete/Text/Format/Link/Comment/Workbooks/Worksheets Tools...

Screen shot of Kutools for Excel

btn read more      btn download     btn purchase

Comments  

Permalink 0 Damon R
Very helpful thank you took me a while to find it but was just what I needed. Note in the VBA code if you want to seperate data with a semicolon, comma or some other charater in the "delim = " "
" field put you charater betwen the quotes example: delim = ";".

Thanks again.
2013-11-25 15:01 Reply Reply with quote Quote
Permalink 0 Romilla W
Thamks a lot for the code. Was very helpful.
2013-12-07 06:48 Reply Reply with quote Quote
Permalink +1 Tom
Thanks very much - was a big help!
2014-04-03 11:43 Reply Reply with quote Quote
Permalink 0 priya
how to merge 2 cell ex:-[a1:41.00] [B1:kWh] [C1:041.00 kWh]
2015-02-07 07:11 Reply Reply with quote Quote
Permalink 0 TJ
Awesome! Greatly helps! Thank you so much!
2015-04-06 03:11 Reply Reply with quote Quote
Permalink 0 jennifer
how repeat the process if i have 4 different reference and need to combine them one after the other
2016-03-13 11:09 Reply Reply with quote Quote
Permalink 0 jennifer
my earlier query is about this vba:Sub MergeOneCell()
'Updateby20140128
Dim Rng As Range
Dim WorkRng As Range
Dim Sigh As String
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.Inp utBox("Range", xTitleId, WorkRng.Address , Type:=8)
Sigh = Application.Inp utBox("Symbol merge", xTitleId, ",", Type:=2)
xOut = ""
Application.DisplayAlerts = False
For Each Rng In WorkRng
xOut = xOut & Rng.Value & Sigh
Next
With WorkRng
.Merge
.Value = VBA.Left(xOut, VBA.Len(xOut) - 1)
End With
Application.DisplayAlerts = True
End Sub
Between, what does the type here, "8" & "2" refers to
2016-03-13 11:12 Reply Reply with quote Quote

Add comment


Security code
Refresh