Merge cells
How to merge cells using Excel and VBA methods
Select cells you want to merge > Home tab > Alignment group > Merge & Center > Merge Cells
1. Select the cells that you want to merge. Note: in this example we are merging cells A2 to D2. |
2. Select the Home tab. |
3. Click on the Merge & Center arrow, in the Alignment group. 4. Click on Merge Cells. |
Select cells you want to merge > Right-click on selected range > Format Cells > Alignment tab > Check Merge cells checkbox > Click OK
1. Select the cells that you want to merge. Note: in this example we are merging cells A2 to D2. |
2. Right-click anywhere on the selected area. 3. Select Format Cells. |
4. Select the Alignment tab. 5. Check the Merge cells checkbox. 6. Click OK. |
METHOD 1. Merge cells using VBA
VBA
Sub Merge_Cells()
'merge range A2:D2 in a worksheet named Sheet1
Worksheets("Sheet1").Range("A2:D2").Merge
Worksheets("Sheet1").Range("A2:D2").Merge
End Sub
PREREQUISITES
Worksheet Names: Have a worksheet named Sheet1.
Worksheet Names: Have a worksheet named Sheet1.
ADJUSTABLE PARAMETERS
Sheet Selection: Select the worksheet in which you want to merge cells by changing the Sheet1 worksheet name in the VBA code.
Merge Cell Selection: Select the range of cells you want to merge by changing range ("A2:D2") in the VBA code.
Sheet Selection: Select the worksheet in which you want to merge cells by changing the Sheet1 worksheet name in the VBA code.
Merge Cell Selection: Select the range of cells you want to merge by changing range ("A2:D2") in the VBA code.
METHOD 2. Merge selected cells using VBA
VBA
EXPLANATION
This tutorial explains and provides step by step instructions on how to merge cells.
This tutorial explains and provides step by step instructions on how to merge cells.
Excel Methods: This tutorial provides two Excel methods that can be applied to merge cells. Both of the methods are very similar to each other, with one using the Home tab and the other using the Format cells option. The first method can be accomplished in four steps, whilst the second in six steps.
VBA Methods: This tutorial provides two VBA methods that can be applied to merge cells. The first method merges the cells specified in the VBA code. The second method merges the selected cells.
RELATED TOPICS
Related Topic | Description | Related Topic and Description |
---|---|---|
Unmerge cells | How to unmerge cells using Excel and VBA methods | |
Wrap text | How to fit content in a cell without adjusting column width using Excel and VBA methods | |
Unwrap text | How to unwrap content in a cell using Excel and VBA methods |