Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, and 2016. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Shortcut to Merge Cells.

Shortcut to Merge Cells

by Allen Wyatt
(last updated December 2, 2017)


Excel allows you to merge cells together in two ways: using the Merge and Center tool on the ribbon or toolbar, or by using the controls in the Alignment tab of the Format Cells dialog box. If you merge cells quite a bit, you might long for a shortcut that will merge whatever cells you've selected.

Unfortunately, Excel doesn't include such a shortcut. You can, however, create one using a macro. The following is a simple macro to merge whatever cells you've selected:

Sub MergeCells1()
End Sub

After you create the macro, you can assign it to a keyboard shortcut and you are set to go. If you instead want a macro that is a shortcut for the Merge and Center tool, then you can use the following:

Sub MergeCells2()
    With Selection
        .HorizontalAlignment = xlCenter
    End With
End Sub

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12458) applies to Microsoft Excel 2007, 2010, 2013, and 2016. You can find a version of this tip for the older menu interface of Excel here: Shortcut to Merge Cells.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...


Pasting Text with Track Changes

Track Changes is a great tool for developing documents. If you want to copy text from one document to another, with ...

Discover More

Selecting the First Cell In a Row

When creating macros, you'll often have a need to select different cells in the worksheet. Here's how to select the first ...

Discover More

Converting Numeric Values to Times

If you have a bunch of times entered into cells without the colon between the hours and minutes, chances are good that ...

Discover More

Excel Smarts for Beginners! Featuring the friendly and trusted For Dummies style, this popular guide shows beginners how to get up and running with Excel while also helping more experienced users get comfortable with the newest features. Check out Excel 2013 For Dummies today!

More ExcelTips (ribbon)

Formatting for Hundredths of Seconds

When you display a time in a cell, Excel normally displays just the hours, minutes, and seconds. If you want to display ...

Discover More

Ensuring Conditional Formatting and Data Validation is Copied

If you use an Excel worksheet for entering data (a quite common task, actually), then you need to be concerned with how ...

Discover More

Flashing Cells

Want to draw attention to some information in a particular cell? Make the cell flash, on and off. Here's how you can ...

Discover More

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.


If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is six more than 8?

2017-12-04 11:00:11

Peter Atherton

Dean Cardno

I liked your tip, but it can be shorter - this one toggles the the alignment.

Sub CentreToggle()
'Dean Cardno; xlTips
With Selection
If .HorizontalAlignment = xlCenterAcrossSelection Then
.HorizontalAlignment = xlLeft
Else: .HorizontalAlignment = xlCenterAcrossSelection
End If
End With
End Sub

2017-12-04 10:18:41

Bryan Marks

Hi, Bill,

Try this Excel Tip from Allen to see if that helps.


2017-12-03 15:19:06

Bill Toney

I have a number of spreadsheets in a workbook, each being labeled year-month (Example: 2017-01, 2015-12, etc.). They were not created in sequence. Is there a way to auto sort the spreadsheets without having to manually move them?

2017-12-02 15:14:29

Dean Cardno

Sometimes merging cells is necessary, but in general it causes more problems that it solves, since it screws up subsequent paste operations. You can get the same visual result by formatting as 'centre across selection' - which is usually the reason for the merged cells in the first place. I have included the following macro in my personal macro add-in file to un-merge merged cells and apply the desired formatting:
Sub CentreAcross()

With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.WrapText = True
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub

I attached it to an icon in the QAT, and use it frequently.

2017-12-02 11:08:58


I've never been a fan of merging cells because it can make manipulating the spreadsheet difficult. But I often want to center across a selection because it is pretty innocuous. Typically, I use this when I want a super heading to center across subordinate headings. Unfortunately, Microsoft doesn't provide a quick way to do this. So I created a macro and added it to my Quick Access Toolbar. It lets me easily center across a selection or, if it is already centered, it un-centers it. The VBA code I created is ...

Sub CenterAcrossSelection() ' Centers and un-centers across a selection
With Selection
If .HorizontalAlignment = xlCenterAcrossSelection Then ' Checks to see if it is already centered
.HorizontalAlignment = xlGeneral ' If so, un-center it using the General alignment
Else ' If it's not already centered, then
.HorizontalAlignment = xlCenterAcrossSelection ' Center across the selection
.VerticalAlignment = xlCenter ' Also center it vertically
End If
End With
End Sub

This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.