View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Edward Ulle Edward Ulle is offline
external usenet poster
 
Posts: 92
Default Reset public variable

Alex,

Try placing an End statement at the end of your macro.

For example

Option Explicit

Public i As Integer

Public Sub Test()
i = i + 1
MsgBox i
End ' Try this with and with out this End statement
End Sub

Without i retains its value from run to run. With it i is reset to 0
everytime you run the macro.



*** Sent via Developersdex http://www.developersdex.com ***