Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Undeclared variables in Excel

Status
Not open for further replies.

xwb

Programmer
Jul 11, 2002
6,828
GB
A friend asked me to look at some of his VBA code. When I tried running it, it moaned about a variable not being defined so I just added it in a dim statement. When I tried running it again, it kept on moaning until I had declared every variable that was used. But then he told me that that code had been running on his machine for the last two years and he never had to declare those variables.

Is there a switch somewhere in Excel that allows you to get away with undeclared variables?
 
Investigate

[tt]Option Explicit[/tt]

and

[tt]Tools/Options/Editor/Require Variable Declarations[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top