Select the cells and press Alt, H, B, A, one key after another, to put All Borders on every side of every selected cell. To draw a border only around the outside of the selection, press Ctrl + Shift + 7 (written as Ctrl + Shift + &) or Alt, H, B, S.
For a single edge, change the last key after Alt, H, B: O bottom, P top, L left, R right, T thick outside border, B double bottom border, H thick bottom border.
To take borders off, press Alt, H, B, N (No Border), which clears every border in the selection. Ctrl + Shift + _ also removes borders without going through the ribbon.
For a line colour, line style, diagonal line or inside-only border, press Alt, H, B, M (More Borders) to open the Border tab of Format Cells, or press Ctrl + 1 and pick that tab. Once a border is applied, F4 repeats it on the next range you select.
If Ctrl + Shift + 7 does nothing, your keyboard layout probably puts & on a different key; the Alt, H, B sequences work on any layout. If the lines vanish when you print, they were gridlines rather than borders, so apply a border before printing. On a Mac the border shortcuts use different keys.
Latest Video Tutorial – 10 Excel Keyboard Shortcuts (Probably YOU are NOT Using)
Excel does not apply any border to the cell on its own, but there are multiple types of border options that you can apply to specific cells, a range, or a whole spreadsheet, manually or with keyboard shortcuts.
In this tutorial, we have explained some keyboard shortcuts to apply borders in Excel.
Shortcut Keys to Apply Border in Excel
The most commonly used border option is “All Borders”, which applies a border to all the sides of each cell. Press these keys one after another, not together:
Alt → H → B → A
Steps to Apply Border Using Keyboard Shortcut
- First, select the cell or range of cells where you want to apply borders, or select the complete data using “Ctrl + A”.

- After that, press Alt → H → B → A in sequence and you will get the borders applied to all the sides of each selected cell.

Shortcut Keys to Apply Some Different Types of Borders
The shortcut key combination for all the types of borders is the same, except for the last key, which changes based on the border type that you want to apply.
- Apply borders to the bottom of the cells: Alt → H → B → O
- Apply borders to the top of the cells: Alt → H → B → P
- Apply borders to the left of the cells: Alt → H → B → L
- Apply borders to the right of the cells: Alt → H → B → R
- Apply borders only outside of the selected range: Alt → H → B → S
- Apply thick borders only outside of the selected range: Alt → H → B → T
- Apply double borders to the bottom of the cells: Alt → H → B → B
- Apply a thick border to the bottom of the cells: Alt → H → B → H
- Apply top and bottom borders: Alt → H → B → D
- Remove all the borders (No Border): Alt → H → B → N

To find and apply more border options, press Alt → H → B → M, and you will get the “Format Cells” dialog box opened with more border options to choose from.

Two Direct Border Shortcuts
Apart from the ribbon keys, Excel also has two shortcuts that you press together:
- Ctrl + Shift + &: applies an outline border around the selected cells.
- Ctrl + Shift + _ (underscore): removes the outline border from the selected cells.
On a Mac, use Command + Option + 0 (zero) to add an outline border and Command + Option + – (hyphen) to remove it.
Frequently Asked Questions
How do I change the border color with the keyboard?
Press Alt → H → B → I to open Line Color, pick the color, and then apply the border with one of the shortcuts above. Or press Ctrl + 1 and use the Border tab of the Format Cells dialog box.
Why does Alt H B A not work?
These keys must be pressed one after another, not held together. If you hold Alt while pressing the other keys, Excel doesn’t follow the ribbon key tips.
Are borders the same as gridlines?
No. Gridlines are the light grey lines Excel shows on every sheet, and they don’t print by default. Borders are lines that you apply to cells, and they print.
Great tips on applying borders in Excel! The keyboard shortcuts are super helpful for speeding up my workflow. Thanks for sharing!
Great tips! I had no idea there was a keyboard shortcut for applying borders in Excel. It’s going to save me so much time. Thanks for sharing!