Just as a heads up, if you declare a variable as a global or Public (Static x as Double or Public x as Double)it will exist outside of a procedure(macro), any variable declared (Dim x as Double) inside a sub will always only exist within the sub. This is Visual Basic std operating procedure, so I would assume( is this going to make an ASS of U and ME ;-) ) it would stand true with Cypress as well.
Eg
' Your code here
Public x as double
' exists everywhere
Sub
' Your code here
Dim x as Double
' Only exists here
End Sub