Clear the Input Cell Style for Printing

I really like to highlight input cells by applying the Input Cell Style. I also like to try to place all of the input cells for a workbook on a single worksheet. That way, it is easy to update the input cells, and since they aren’t on any of the sheets I need to print, the input cell style formatting isn’t an issue. However, sometimes it may be necessary to place an input cell in a worksheet that will be printed. So, this post provides a macro that instantly removes the Input Cell Style formatting so you can print. A second macro restores the default cell style formatting.


Before we jump right in to the technical stuff and the VBA code, let’s just be sure we are on the same page. Let’s say we have some input cells that store the company name and contact name, as shown below.

Input cells by Jeff Lenning

We want to identify the input cells to make it easy for a user to know which cells require input. So, we select the input cells and apply the Input Cell Style (found in the Cell Styles gallery on the Home tab). The result is shown below.

Input Style by Jeff Lenning

Now the input cells are easy to see. When we apply the Input Cell Style on worksheets that don’t need to be printed, life is good. But, when we apply the Input Cell Style on sheets that are designed to be printed, we may not want the formatting to appear on the printed page.

So, this post walks through one way to approach this issue, which is to run a macro prior to printing that clears the Input Cell Style formatting. Then, you would print the worksheet. Then, you would run another macro that restores the Input Cell Style formatting.

Sound good? Alright, let’s get to it.


Since we have previously discussed recording macros, the personal macro workbook, and setting up a macro toolbox, rather than rehash all of those details again here, I’ll provide links to those posts below, and proceed directly to the VBA code. You can copy the code and paste it into your VB Editor as needed. Or, if you prefer, just download the sample Excel file below which has the VBA code.

In practice, after applying the Input Cell Style, the basic idea is that you would:

  1. Clear the Input Style Formats
  2. Print the Worksheet
  3. Restore the Input Style Formats

Let’s walk through these steps.

Clear the Input Style Formats

So, assuming that you have already applied the Input Cell Style to various cells throughout the workbook, you’ll want to run this macro.

Sub InputStyleClear()
  With ActiveWorkbook.Styles("Input")
   .Interior.Pattern = xlNone
   .Font.ColorIndex = xlAutomatic
   .Borders(xlLeft).LineStyle = xlNone
   .Borders(xlRight).LineStyle = xlNone
   .Borders(xlTop).LineStyle = xlNone
   .Borders(xlBottom).LineStyle = xlNone
  End With
End Sub

As you look through the code, you can see it applies various formats to the Input style, namely, it removes the fill, sets the font color to automatic, and removes the borders.

Note: There are a variety of ways to run macros, including setting up a QAT button, a worksheet button, the Macros dialog, or even the VB editor. For more information, check out the additional resources below.

After you run the macro, the Input Cell Style is still applied to the input cells, but, the formatting is updated so that it appears as any normal cell, that is, without the fill, borders, or font color.

Print the Worksheet

Now, you can print the worksheet as needed, and the input cells won’t display the typical blue borders, blue font, and cell fill.

Once you are done printing, you are ready to restore the formats.

Restore the Input Style Formats

To restore the default Input Style formats, you would run this macro.

Sub InputStyleRestore()
  With ActiveWorkbook.Styles("Input")
    .Interior.Color = 10079487
    .Font.Color = -9027777
    .Borders(xlLeft).Color = -8421505
    .Borders(xlRight).Color = -8421505
    .Borders(xlTop).Color = -8421505
    .Borders(xlBottom).Color = -8421505
  End With
End Sub

As you look through the code, you can see that it updates the Input Style format, and essentially restores the built-in formatting.

If you have any other Style-related tips, please share by posting a comment below…thanks!

Additional Resources



This article was written by Jeff Lenning


  1. Dave Marriott

    You can achieve a similar result by using the black and white checkbox in page setup.

    1. Jeff Lenning Post author

      Thanks Dave!

  2. Steven Winokur

    OK… I have to admit I am a super high end Excel user who can not master macros. SO I don’t even think in that language (though I did big time in the old Lotus days). Anyway… I have a different solution completely:

    A) I also love to have an input worksheet that feeds my real worksheet.
    B) I always protect myself by setting up my worksheets with conditional formatting that tells me if someone inadvertently puts a number in a formula cell by using “+not(isformula(a1))” and having the result print in a different color. BUT, I don’t want that to show when I print.
    C) So I set up a cell in my input sheet that uses data validation and only gives the choice of “hide” or “don’t hide”
    D) Then in my real worksheet, I set up a final conditional format that says if that cell says “hide” then have no highlighting.
    E) Poof, highlighting is gone. It’s easy to toggle on and off for review purposes as well.

    1. Jeff Lenning Post author

      Great idea! Thanks for sharing it 🙂

  3. John Abrassart

    I concur completely. Having an Input “style” that’s applied to input areas of your sheet is invaluable. And, I agree with Steve that having an INPUT tab in each workbook I build is pretty common. My Input Style only affects two things: the Fill and the Protection (No protection). The latter setting limits users to just entering data in your input cells if you decide to Protect your workbook.

    I usually select light cyan, light green or light yellow for my Fill because it still provides the visual cue and is virtually undetectable on a lot of printers. Although, we don’t actually mind printing the colors in most cases. But if I have a situation in which I do want to turn the color off, I just modify the Input Style to “No Fill” temporarily, print the sheet and then return the Input Style to its original setting.

    I suppose I could do this with a macro but I prefer to keep my sheets simple.

    1. Jeff Lenning Post author

      Thanks for your comment…really appreciate it!

  4. M

    I am getting into the habit of having an “instructions_settings” tab on each of my regular spreadsheets, then hide the tab when I send it to head office. This tab has the dates and other input details plus quick screen shots and instructions. Some spreadsheets I only complete on a quarterly basis so I sort of forget the best way to complete them, these instructions just refresh my memory.

    I love the macro idea though.

    I love your blog. Thank you.

    1. Jeff Lenning Post author

      Excellent ideas, and thanks 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

By submitting this form, you accept the Mollom privacy policy.