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?
相关问题
- Excel sunburst chart: Some labels missing
- Error handling only works once
- Error handling only works once
- Excel formula in VBA code
- Excel VBA run time error 450 from referencing a ra
相关文章
- Get column data by Column name and sheet name
- programmatically excel cells to be auto fit width
- Unregister a XLL in Excel (VBA)
- Unregister a XLL in Excel (VBA)
- Loss of variables switching orientations
- How to prevent excel from truncating numbers in a
- numeric up down control in vba
- What is the limit in size of a Php variable when s
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:
Another option (because I don't have admin privileges to install that software), is to put
Option Explicit
at the top of your module. Then comment out all theDim
'med variables, and debug through your code.Uncomment the
Dim
s one by one untilOption Explicit
returns no compiler errors, at which point any variables still commented out can be ignored, as they are not used in your codeSimilar to MZ-Tools, RubberDuck has a VariableNotUsed Inspection (amongst many other things) that should show precisely what you're after. It's free and, as of v2.2.0.3086, it supports non-admin installation.