Sometimes, we highlight cells in Excel depending on values or specific conditions by using some Fill Colors. But when printing, we do not want these cells to be highlighted. Here, you will find 2 ways to highlight cells in Excel but not print.
Highlight Cells in Excel but Not Print: 2 Ways
Here, we have a dataset containing the Student ID, Name, and Scores of some students. Now, we will highlight the top 2 and bottom 2 scores by using Conditional Formatting.
Here are the steps.
Steps:
- Firstly, select Cell range D5:D11.
- Then, go to the Home tab >> click on Conditional Formatting >> click on Top/Bottom Rules >> select Top 10 Items.
- Now, the Top 10 Items box will open.
- After that, select 2 as the number of Cells to be formatted with Green Fill with Dark Green Text.
- Next, click on OK.
- Again, select Cell range D5:D11.
- Then, go to the Home tab >> click on Conditional Formatting >> click on Top/Bottom Rules >> select Bottom 10 Items.
- Now, the Bottom 10 Items box will open.
- After that, select 2 as the number of Cells to be formatted with Light Red Fill with Dark Red Text.
- Next, click on OK.
- Thus, we have highlighted the top 2 and bottom 2 scores.
Now, we will show how you can print this dataset without highlighting these cells using the Page Setup Feature and VBA.
1. Use of Page Setup Feature to Highlight Cells but Not Print
In the first method, we will show you how to highlight cells in Excel but not print using the Page Setup Feature. Go through the steps given below to do it on your own dataset.
Steps:
- In the beginning, go to the Page Layout tab >> click on the Page Setup button.
- Now, the Page Setup box will appear.
- Then, go to the Sheet tab >> turn on Black and white from the Print options.
- After that, click on OK.
- Finally, if you print the Excel file, the Cells will not be highlighted. You can also check this in preview before printing.
Read More: How to Highlight Blank Cells with Conditional Formatting in Excel
2. Using VBA to Highlight Cells in Excel but Not Print
Now, we will show you how to highlight cells in Excel but not print using VBA. Follow the steps given below to do it on your own dataset.
Steps:
- Firstly, go to the Developer tab >> click on Visual Basic.
- Now, the Microsoft Visual Basic for Applications box will open.
- Then, double-click on ThisWorkbook.
- After that, insert the following code in ThisWorkbook.
Code Breakdown
- Firstly, we selected Workbook from General and BeforePrint from Declarations as an event to execute the code before printing.
- Then, we set EnableEvents of the Application as False.
- Next, we set Cancel as True.
- After that, we set the PageSetup as BlackAndWhite for the ActiveSheet.
- Then, we call for the Printout of the ActiveSheet.
- Afterward, we set BlackAndWhite from PageSetup as False.
- Finally, we set EnableEvents of the Application as True.
- Next, click on the Save button to save the code and go back to your worksheet.
- Finally, if you print the Excel file, the cells will not be highlighted. But you cannot check this in preview before printing.
Read More: How to Highlight Selected Cells in Excel
Practice Section
In this section, we are giving you the dataset in an additional worksheet to practice on your own and learn to use these methods.
Download Practice Workbook
Conclusion
So, in this article, you will find 2 ways to highlight cells in Excel but not print. Use any of these ways to accomplish the result in this regard. Hope you find this article helpful and informative. Feel free to comment if something seems difficult to understand. Let us know any other approaches which we might have missed here. Thank you!
Related Articles
- How to Highlight Cell If Value Is Less Than Another Cell in Excel
- Cells Are Not Highlighting in Excel Formula
- How to Highlight Cells in Excel Based on Value
- How to Click One Cell and Highlight Another in Excel
- How to Highlight Cells Based on Text in Excel
- Highlight Cells That Contain Text from a List in Excel
- How to Highlight Cell Using the If Statement in ExcelÂ