Is there a way in VBA to know about variables that aren't being used?

Lance Roberts picture Lance Roberts · Oct 9, 2008 · Viewed 8.6k times · Source

Is there a tool, method or setting in the standard VBA Editor to warn about variables that have been Dim'med, but aren't being used?

Answer

Jon Fournier picture Jon Fournier · Oct 9, 2008

MZ-Tools will search through your code and tell you what is not being used. The version for VBA can be found here.

The specific feature in MZ-Tools that performs what you asking about is Review Source Code:

The Review Source Code feature allows you to review the source code to detect some unused declarations (constants, variables, parameters, procedures, etc.).