Unused local variable: '<localvariablename>'
TOC
Collapse the table of content
Expand the table of content
The document is archived and information here might be outdated

Unused local variable: '<localvariablename>'

A local variable in a procedure is declared but never used.

One possibility is that there is a spelling mistake among the local variables in the procedure. If this variable is in fact used in another statement but spelled differently, it will appear to the compiler as two different variables.

By default, this message is a warning. For more information about hiding warnings or treating warnings as errors, see Configuring Warnings in Visual Basic.

Error ID: BC42024

To correct this error

  1. Check for spelling mistakes among the local variables within the procedure. Notice that casing does not make a difference. The names ABC and abc are considered to refer to the same variable.

  2. If there is no spelling mistake, either remove the declaration of this variable or use it in another statement in the procedure.

Show:
© 2016 Microsoft