Variables are private unless you make the Public outside of a Sub or Dim outside of Sub.
Undefined variables are sometimes mistaken due to spelling errors. Other times, if not set as another part expects, it will show a problem.
e.g.
[VBA]
Public s as String
Sub t
s="Hello World!"
tt
End Sub
Sub tt
MsgBox s
End Sub
[/VBA]