Module level variable : Variable Scope « Language Basics « VBA / Excel / Access / Word






Module level variable

 

Option Explicit
Dim Sales

Sub Scope1()
  Sales = Sales + 1
  MsgBox Sales
End Sub

Sub Scope2()
  Sales = Sales + 10
  MsgBox Sales
End Sub

 








Related examples in the same category

1.Local variable
2.Procedure-Level (Local) Variables
3.module-level variable declared with Private statement
4.Understanding Module-Level Variables
5.Public Variables
6.Understanding and Using Static Variables
7.sub module scope
8.Local variables are available only in the procedure where they are declared
9.Private module variable