variable estática VBA
' Static variable inside a function
Function MyStaticFunction(ByVal pToAdd As Integer) As Integer
Static iStatic As Integer ' Keeps its value between calls
iStatic = iStatic + pToAdd
MyStaticFunction = iStatic
End Function
'---------------------------------------------------------------------
Sub TesMe()
Debug.Print MyStaticFunction(1) ' 1
Debug.Print MyStaticFunction(3) ' 4
End Sub
VasteMonde