How to: Merge Cells or Split Merged Cells

This example demonstrates how to merge several cells into a single cell. To do this, use the Worksheet.MergeCells method with the passed range of cells to be merged.


When you merge a cell range, the data (value, formula and format settings) of only the top left non-empty cell will appear in the resulting merged cell. The data contained in other cells of the original range will be lost.

If all cells within the original range are empty, the range’s top left cell format will be applied to the merged cell.

View Example

// Merge cells contained in the range.