Excel

Hide The Zeros

Ease of Use

Easy

Version tested with

2000 

Submitted by:

johnske

Description:

Worksheets will no longer show zero values. 

Discussion:

When worksheets contain lots of formulas and/or links to other sheets or workbooks with many zero values it can be very difficult to read through this to find the data you want. Display zero values is one of many other options available in the 'Tools' menu. However, when using this option, it only applies your choice to the active sheet. So if you want to use the option of not showing zero values to the whole workbook it can take some time to apply it manually. In such cases, the following code can save you a lot of time. 

Code:

instructions for use

			

Option Explicit Private Sub Workbook_SheetActivate(ByVal Sh As Object) ActiveWindow.DisplayZeros = False End Sub

How to use:

  1. Open an Excel workbook
  2. Select Tools/Macro/Visual Basic Editor
  3. In the VBE window, select Tools/Project Explorer
  4. Select the ThisWorkbook module
  5. Copy and paste the code into the Module
  6. Now select File/Close and Return To Microsoft Excel
  7. Dont forget to save your changes...
 

Test the code:

  1. Type in a zero (0) in any cell on any sheet and note that this 0 is not displayed in the cell.
  2. The attachment contains two almost identical workbooks:
  3. DontKillZeros does NOT have the above code in it, and you'll notice all zero values are shown
  4. KillZeros DOES have the above code in it, and you'll notice no zero values are shown.
 

Sample File:

KillZeros.zip 8.08KB 

Approved by mdmackillop


This entry has been viewed 234 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express