Here are five different ways to align cells to the right in Excel:
Method 1 – Using the Home Ribbon
The most common way to right-align the contents of a cell is to use Excel’s Ribbon tool.
Simply select the cells you want to align, go to the Home tab, and click the Align Right icon in the Alignment section.
Method 2 – Using the Format Cells Wizard
We can also use the Format Cells dialog box to align cells to the right.
Steps:
- Select the range B5:D14.
- Right-click on your mouse and choose Format Cells from the context menu. Or press Ctrl+1.
The Format Cells dialog box will open.
- Select the Alignment tab.
- In the Horizontal field, click the drop-down.
- Choose the Right (Indent) option.
- Click OK.
Method 3 – Applying a Custom Number Format
In this technique, we’ll utilize the Custom option in the Format Cells dialog box.
Steps:
- Select the range B5:B14, and press Ctrl+1.
The Format Cells dialog box will appear.
- Go to the Number tab >> Custom >> Type:
* @
>> Click OK.
The column will be right-aligned.
Method 4 – Using a Keyboard Shortcut
Steps:
- Select the data to align.
- Press ALT+H then A then R.
The data will be aligned on the right.
Read More: How to Center Text in a Cell in Excel
Method 5 – Using Excel VBA
We can completely automate the preceding approaches using VBA code.
Steps:
- Select the range D5:D14.
- Navigate to the Developer tab.
- Click the Visual Basic button, or just press ALT+F11.
- Go to the Insert tab >> Module.
- Copy the code below and paste it into the Module window that opens:
'This is sub routine for right-aligning a range of cells
Sub ExcelRightAlign()
'Using the Selection and Horizontal Alignment properties
Selection.HorizontalAlignment = xlRight
End Sub
- Save the code.
- Press F5 or click the green Run button to run the code.
The range D5:D14 is right-aligned.
However, we have other columns which are not right aligned. Yet.
- Select the remaining left-aligned range B5:C14.
- Go to the Developer tab and select Macros.
- In the Macro wizard, select the Macro and click the Run button.
The selected cells will be right-aligned.
Download Practice Workbook
Related Articles
- All Types of Alignment in Excel
- [Fixed!] Excel Cell Alignment Not Working
- How to Top Align in Excel
- Align Two Sets of Data in Excel
- How to Bottom Align in Excel
- How to Left Align in Excel
<< Go Back to Alignment in Excel | Excel Cell Format | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!