View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Problems running my app more than once

If you your code writes values to your globals, and you don't do anything to
reset them, then they will continue to hold those values until you hit and
END statement (which also immediately halts excecution) or you modify them
(or manually do a reset in the vbe or close the workbook). It is unclear
how your code initializes these globals, but if it could leave residual
values, then that might be the source of the problem.

You can look at help on the Erase command for information on clearing
dynamic arrays. For other variables, just set the value you want (which your
code should be doing anyway).

--
Regards,
Tom Ogilvy

"Eric Wescott" wrote in message
om...
I wrote a little VBA app that reads some data from a workbook and
creates a new one based on the information. Well if certain
information from the source book is invalid I report it to the user to
correct and then rerun the app. However if you rerun the app after
correcting the source workbook the final created workbook isn't always
the same. However if you save your data, exit excel and reopen and run
it is always consistant. I do have a few globals in the app.. Is there
something I need to do in order to reset all data to initial values?

(Here are my globals)
Option Explicit
Private ID() As String, amnt() As Currency, ArraySize As Integer,
ArrayPos As Integer, ERRORS As Boolean

Thanks
Eric