Inspection Details

VariableNotUsed


Summary
Warns about variables that are never referenced.
Reasoning
A variable can be declared and even assigned, but if its value is never referenced, it's effectively an unused variable.
The following code example(s) would trigger this inspection:

Public Sub DoSomething()
    Dim value As Long ' declared
    value = 42 ' assigned
    ' ... but never rerenced
End Sub

The following code example(s) would not trigger this inspection:

Public Sub DoSomething()
    Dim value As Long
    value = 42
    Debug.Print value
End Sub


Back to List