View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
joeu2004[_2_] joeu2004[_2_] is offline
external usenet poster
 
Posts: 829
Default Compile Error:Variable not defined

Errata....

"joeu2004" wrote:
My guess is: you have an Option Explicit near the top
of the module. [....] But it does mean that you must
declare every variable explicitly. For example:
Sub GuessName()
Dim Msg As String, Ans As String


Of course, that should Ans As Long.

PS: Always use Long instead of Integer or Byte, unless you are allocating a
huge array. The point is: for individual variables, there is no longer any
advantage to using smaller integer types; and more often than not, there is
a disadvantage.

Similarly, always use Double instead of Single.