+ Reply to Thread
Results 1 to 3 of 3

variables:Option Explicit

  1. #1
    Registered User
    Join Date
    02-25-2008
    Posts
    2

    variables:Option Explicit

    I also have a question about this, when we have variables like string, integer or variant. When we put Option Explicit, do we put it at the top of the code<--- Like at the very beginning eventhough the following code after option explicit is not using variables or using option explicit following a code that uses variables. If you would like me to clarify this question you can AIM or YAHOO IM me, AIM is ladeda063610 and Yahoo is ladeda16

    Thanks in advance

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678
    It goes at the top of the module, before any variable declarations, subs, or functions.

  3. #3
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464
    Quote Originally Posted by snakeman11689
    I also have a question about this, when we have variables like string, integer or variant. When we put Option Explicit, do we put it at the top of the code<--- Like at the very beginning eventhough the following code after option explicit is not using variables or using option explicit following a code that uses variables. If you would like me to clarify this question you can AIM or YAHOO IM me, AIM is ladeda063610 and Yahoo is ladeda16

    Thanks in advance
    You put it outside any Procedure (Sub..End Sub) code, and at the top of a module or workbook code window. Of course if you set the VBA defaults and tick the 'Require Variable Declaration' option then you'll always have it.

    Rgds

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1