How do I set the option in Excel VBA that I MUST Dim variable before using them? I would prefer it this way to the default where Excel just 'creates' variables that are spelt differently etc.
Thanks,
Phil
How do I set the option in Excel VBA that I MUST Dim variable before using them? I would prefer it this way to the default where Excel just 'creates' variables that are spelt differently etc.
Thanks,
Phil
type "option explicit" prior to sub
Originally Posted by Phil_V
Check out this link...
http://www.cpearson.com/excel/DeclaringVariables.htm
--
HTH...
Jim Thomlinson
"Phil_V" wrote:
>
> How do I set the option in Excel VBA that I MUST Dim variable before
> using them? I would prefer it this way to the default where Excel just
> 'creates' variables that are spelt differently etc.
>
> Thanks,
>
> Phil
>
>
> --
> Phil_V
> ------------------------------------------------------------------------
> Phil_V's Profile: http://www.excelforum.com/member.php...o&userid=31857
> View this thread: http://www.excelforum.com/showthread...hreadid=523711
>
>
Put Option Explicit as the very first line in your code
module(s), before and outside of any procedure declaration.
You can have this automatically placed in new modules. In VBA go
to the Tools menu, choose Options, then the Editor tab. There,
place a check next to "Require Variable Declaration".
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
"Phil_V" <[email protected]>
wrote in message
news:[email protected]...
>
> How do I set the option in Excel VBA that I MUST Dim variable
> before
> using them? I would prefer it this way to the default where
> Excel just
> 'creates' variables that are spelt differently etc.
>
> Thanks,
>
> Phil
>
>
> --
> Phil_V
> ------------------------------------------------------------------------
> Phil_V's Profile:
> http://www.excelforum.com/member.php...o&userid=31857
> View this thread:
> http://www.excelforum.com/showthread...hreadid=523711
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks