If you want to define global variable, insert new module and declare it this way:
Public xSharedValue As Integer
But...
You can call one sub from another:
Private Sub Button1_Click
DoSomething(x)
End Sub
Private Sub DoSomething(ByVal x As Integer)
End Sub
If a
DoSomething
procedure is in a different module, you have to change its declaration to:
Private Public Sub DoSomething(ByVal x As Integer)
End Sub
For further details, please see:
Scope of variables in Visual Basic for Applications[
^]