Free Download

Learn 7 Reasons Why Becoming a Technical Writer is a Great Career Move!

New Graphic

Every Week! 

Subscriber Counter

We value your privacy. We will not share your information with anyone.

Online Video Courses

Plain writing SAVE 20% TODAY!
Learn Plain Writing
------------------------------------ technical writing SAVE 20% TODAY!
Learn Technical Writing
------------------------------------ research paper writing SAVE 20% TODAY!
Write Great Research Paper
------------------------------------ MS Word Power Tips
MS Word Power Tips

How to Merge MS Excel Cells but Justify the Text to the Right (or Left)

© Ugur Akinci

Merging MS Excel cells and centering the contents is so easy: you just select the cells and click the Merge & Center button on the Home tab of the ribbon.

But what if you don;t want the content to center? What if you’d like to left- or right-justify the text within the merged cells?

Then you need a simple macro.

1) Press Alt + F11 to display the VBA Editor.

2) Select the Worksheet you’re working on from the VBA Project pane.

3) Right click and select New > Module to create a new module.

4) Click the new module to enable its code pane on the right:

MS Excel Merge and Left or Right Justify 1

5) In the code pane, enter this VBA code:

Sub MergeRight()
    With Selection
        .HorizontalAlignment = xlRight
    End With
End Sub

6) Save your workbook and switch back to your worksheet (Alt + F11).

7) Select the cell range you like.

MS Excel Merge and Left or Right Justify 2

8) On the ribbon, select Developer. Click Macros to display the list of macros recorded. Your MergeRight macro should be there:

MS Excel Merge and Left or Right Justify 3

9) Select the macro and click Run to right-merge all your content:

MS Excel Merge and Left or Right Justify 4

Similarly, to merge and left-justify your content, you can change the “xlRight” in the VBA formula to “xlLeft“.

But even simpler, just select the Merge Across option from the Merge & Center drop-down list:

MS Excel Merge and Left or Right Justify 5


Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>