PDA

View Full Version : Public variable doesn't reset



RECrerar
09-14-2007, 03:51 AM
This a a confusing problem.

I have a variable

Public IERROR3 as integer

If I run the macro under certain conditions this will be set to IERROR3 = 1

My problem is that sometimes if I run the macro and this condition is reached, if I then re-run the macro the variable does not reset to IERROR3 = 0. The very first line of the macro is IERROR3 = 0!!!!!

This produces an error, if I then just click [End] rather than [Debug] on the Debugging form and run the macro again, the error rests itself and the program runs fine.

Any Ideas why this is happening, or how I can prevent it from happening?

rory
09-14-2007, 04:02 AM
Either something else is setting the value of IERROR3 or something in your code after the IERROR3 = 0 line is changing it. or you have a typo.

Bob Phillips
09-14-2007, 04:10 AM
Seems very odd. What error is it?

RECrerar
09-14-2007, 07:18 AM
Hey Sorry for the slow reply was on lunch, and have since been going through the code line by line and couldn't find anything that could be causing an issue, so still very perplexed.

The Error in Question isn't an Error in a programming sense, but the program has to determine how far 1 point is from another and if the distance between them is greater than a certain value that produces the error and gives you the chance to correct the location of one of the points. (The program is interfacing with a Finite Element Analysis program)

Have since realised that it will be more user firendly if i change the order of some aspects of the program, so will do that and if the problem still persists get back to you.

Bob Phillips
09-14-2007, 09:11 AM
If and when you do, posting the workbook would be helpful, together with a simple explanation of how we can reproduce the problem and how it manifests.

unmarkedhelicopter
09-14-2007, 11:04 AM
What sort of event triggers the code ?