To highlight cells in Excel and keep their lines visible, select the cells, choose a fill color from Home > Fill Color, then apply Home > Borders > All Borders. A fill color covers Excel’s faint worksheet gridlines in those cells; borders add clear lines on top. If you only need the lines on screen, you can also check that gridlines are turned on.
This guide uses Excel for Microsoft 365 on Windows. It explains how to highlight cells with a fill or conditional formatting, preserve the cell boundaries, and handle printing. The key distinction is that gridlines are a worksheet display feature, while borders are cell formatting. You can use both, but a visible border is the dependable choice around colored cells and on a printed page.
What You’ll Need
- An Excel workbook with the worksheet and cells you want to format.
- A fill color and, if you want the lines to show clearly through the highlighted area, a border color or style.
- If you need a paper or PDF copy, access to Excel’s print settings or print preview.
Step-by-Step
- Select the cells to highlight. Click a cell and drag across a range, or click the first cell, hold Shift, and click the last cell. To select a complete column or row, click its letter or number heading. To select nonadjacent areas, hold Ctrl on Windows while selecting each area. On Mac, use Command for nonadjacent selections. Make sure the selection includes all the cells where you want color and lines.
- Apply a fill color. On the Home tab, open the dropdown arrow beside the paint-bucket Fill Color button and choose a color. Clicking the main part of the button applies its currently displayed color. A light shade is often easiest to read behind text. If you choose a color and the gridlines seem to disappear, that is normal: Excel’s default gridlines are not drawn over cells with a fill.
- Add borders over the highlighted cells. Keep the range selected and go to Home > Borders. Choose All Borders to draw lines between the selected cells and around the outside edge. This is usually the right choice when you want every row and column boundary to remain visible. If you choose Outside Borders, Excel draws only the perimeter; it does not restore the internal lines between cells.
- Choose a subtle border style if the default looks too heavy. Open Home > Borders again and use the border color or line-style controls in its menu before applying the borders. For a softer result, choose a thin line in a gray that contrasts with the fill. If your version presents the detailed controls through More Borders, open the Format Cells dialog, choose the Border tab, select a line style and color, then click the inside and outside border buttons in the preview. Click OK to apply. The preview helps you confirm that internal lines are included.
- Check that worksheet gridlines are enabled. Click the View tab and, in the Show group, turn on Gridlines if it is unchecked. This controls the faint default lines in unfilled cells; it does not replace borders on filled cells. The setting applies to the active worksheet, so check other sheets separately if needed. On Mac, use the View tab and the Gridlines option; labels or ribbon layout can vary slightly by Excel release.
- Use conditional formatting for highlights that change automatically. Select the range, then choose Home > Conditional Formatting and select a suitable rule, such as Highlight Cells Rules or New Rule. Set the condition and choose a fill format. To keep boundaries visible when the rule applies, open the rule’s formatting options, go to its Border settings, and specify the line style, color, and borders. The exact dialog depends on the rule type. If the rule changes only the fill, the default gridlines will still be obscured in cells where the fill appears, so include a border in the rule rather than relying on gridlines.
- Check the result, then save. Click outside the selection and inspect the colored area at normal zoom. Confirm that the text is readable and internal lines appear where you need them. If this is for printing, open File > Print and review the preview. For printed gridlines on Windows desktop Excel, go to Page Layout, find Sheet Options, and check Print under Gridlines. This setting can print gridlines in unfilled cells, but borders remain the more reliable way to show lines through highlighted cells. Save the workbook after checking the intended output.
In Excel for the web, you can use the View tab’s Gridlines option to show or hide worksheet gridlines, and the Home tab to apply fills and borders. If you cannot find a detailed border or print option in the web interface, open the workbook in the desktop app. The desktop print settings provide more control over printing gridlines.
Common Mistakes
- Expecting gridlines to show through a fill. Gridlines are not cell borders and generally disappear where a cell has a fill color, even if that color looks nearly white. Apply borders to the filled range if you need visible divisions.
- Choosing Outside Borders instead of All Borders. Outside Borders frames the range but leaves the inside cells without added lines. Choose All Borders, or use the Format Cells Border tab to specify both internal and outside lines.
- Turning on gridlines and assuming that solves printing. The View setting affects what you see on screen. Printed gridlines have a separate setting in desktop Excel, and colored cells may still need borders for clear printed divisions.
- Using a border color that blends into the fill. A border can be present but hard to see if its color is too close to the background. Pick a line color with enough contrast, then check it at the size you plan to view or print.
- Applying a conditional-formatting fill without a border. A rule can make the gridlines vanish only when its condition is met. Edit the rule’s format and add borders if the boundaries must remain visible as values change.
Tips
- Prefer borders for important tables. Gridlines are useful for navigating an ordinary worksheet, but borders are actual formatting. They travel with the cells when the workbook is opened elsewhere and can appear in print.
- Keep visual emphasis restrained. A pale fill with thin gray borders often keeps a table readable without making every cell compete for attention. Use a stronger fill only where it helps distinguish a total, status, or key input.
- Apply formatting to the right-sized range. If you highlight a whole column but only want a small table formatted, select the table cells instead. This avoids unexpected borders or colored cells far below the data.
- Use Format Painter for repeated formatting. Select a correctly formatted range, choose Home > Format Painter, then drag over another range. Check the result afterward, especially if the destination has a different size or layout.
- Save a clean copy before changing a large sheet. Formatting can be cleared or adjusted, but a copy gives you a simple way back if you apply a fill or borders to the wrong range.
Troubleshooting
The gridlines vanished after I added color. Select the colored cells and apply Home > Borders > All Borders. Turning on View > Gridlines restores default gridlines in unfilled cells, but it does not draw them over the filled cells. If the cells are only very lightly colored, the gridlines can still be hidden even when the fill is difficult to notice.
I see an outline but no lines between cells. The range likely has an outside border only. Select it again and choose Home > Borders > All Borders. If that does not produce the appearance you want, open the border settings in the Format Cells dialog and confirm that inside horizontal and vertical borders are selected.
The lines show on screen but not in the printout. Use File > Print to inspect the preview. On Windows desktop Excel, enable Page Layout > Sheet Options > Gridlines > Print for default gridlines in unfilled areas. For cells with a fill, add actual borders; those are more dependable than print-gridline settings. Also check that the selected print area includes the formatted cells.
My conditional format removes the lines again. Edit the rule from Home > Conditional Formatting > Manage Rules, select the relevant rule, and choose Edit Rule or its formatting control. Add the desired border in the rule’s format settings. If the rule is difficult to adjust, a manual border on the cells may work for a fixed range, but test whether the rule’s formatting overrides it.
I cannot see the Gridlines checkbox. Make sure you are on the worksheet rather than a chart sheet, and expand the ribbon if it is collapsed. Gridline display is a per-worksheet setting. In Excel for the web, look under View; if you need a desktop-only print control or a detailed border dialog, open the file in Excel for Microsoft 365 on Windows or Mac.
Frequently Asked Questions
Can I highlight cells without hiding Excel gridlines?
Not with a regular fill alone: a filled cell normally covers the default gridlines. Add borders to the highlighted range to keep its cell divisions visible. A border is separate from the fill and can be styled to resemble subtle gridlines.
What is the difference between gridlines and borders?
Gridlines are faint worksheet guides that can be switched on or off for a sheet, and they are not cell formatting. Borders are formatting applied to selected cell edges. Borders can be colored, styled, and printed, which makes them the better option for a finished table.
How do I keep lines when I highlight an entire row?
Select the row or the relevant cells, apply the fill, and choose Home > Borders > All Borders if you want boundaries around each cell. If you only need a line above or below the row, choose the appropriate top or bottom border instead of adding every edge.
Will borders print if gridlines are turned off?
Yes. Borders are cell formatting and normally print with the worksheet even when default gridlines are hidden. Check File > Print before printing to confirm the range, layout, and appearance.
Can conditional formatting keep the lines visible?
Yes, if the conditional-formatting rule includes borders in its format. Edit the rule and set the border edges you need. A rule that changes only the fill does not make Excel’s underlying gridlines show through the colored cells.
Related
- How to Find Duplicate Values in an Excel Column Fast
- Find Duplicate Words in Excel: A Step-by-Step Guide
- Find Duplicate Numbers in Excel: A Step-by-Step Guide
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Add in Excel Across Different SheetsTo add values from the same cell on several worksheets, use =SUM(Jan!B2,Feb!B2,Mar!B2). This example assumes the values are…
- How to Double Space in Word (Microsoft 365)To double-space text in Word for Microsoft 365, select the text—or press Ctrl+A on Windows or Command+A on…
- How to Read a Box Plot in Excel: A Practical GuideTo read a box plot in Excel, locate the median line inside the box, use the box edges…
- Excel Data Validation Lists: Add New Items in ExcelTo add an item to an Excel data validation list, update the list source: edit the comma-separated entries…
- Excel Shortcut to Insert Copied CellsIn Excel for Microsoft 365 on Windows, copy the cells with Ctrl+C, select the destination, and press Ctrl+Shift++…
- Excel Random Numbers Between a Range and ValueIn Excel for Microsoft 365, use =RANDBETWEEN(1,100) to generate a random whole number from 1 through 100, including…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.