View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Mike S[_5_] Mike S[_5_] is offline
external usenet poster
 
Posts: 86
Default only 1 time declaring variables

On 8/12/2011 11:45 AM, Swingleft wrote:
Hello,
question on how to declare variables.
I have something simples like this
Sub Test ()
Dim H1 As Integer
H1 = Range("B6").Value
MsgBox ("Test number: " & H1 )
End Sub
Is there an easy way to use the "H1" value without again having to
declare it?
Sub Test2 ()
MsgBox ("Test 2 number : " & H1 )
End Sub
--------------------------
thanks for the help again
Swingleft


Variable scope:

http://support.microsoft.com/kb/141693
http://www.ozgrid.com/VBA/variable-scope-lifetime.htm