Hi everyone,
my Excel program has developed a very strange behavior and I have no clue what's going on. I hope you can help me out.
When clicking on a certain button, the method "Click2Select_Click" is started and the the user has to click through the userform "Form_SelectScoringFunction", some calculations happen, all is good. After unloading the userform, the value of numberOfAlternatives, used as an indicator for all other variables, is still 1. Great! It is continues to equal to 1 when moving to End Sub with F8. Upon actually ending the sub, every variable I use, no matter if public or private, goes to 0 or False. Print Err.Number simply leads to "0".
Now what's really puzzling me is that after rebooting Windows, the program works fine for some iterations (~5x) until this bug reoccurs. Therefore, I guess it's not actually a direct problem of my coding but some higher-level stuff that I have no clue of. So there is a chance that the problem will not even happen on your computer but here's a guide on how to get there and you find my file attached.
1. Just click "skip" on the UI that pops up on startup.
2. The table is already reset but you can click on reset again if you want to make sure. All variables have their original value now, numberOfAlternatives e.g. should be 1.
3. Click on any "Click to select a scoring function". Select any that you wish, doesn't matter. Choose "Manual scoring" and click "Confirm" (you can also choose "Automated scoring" if you want to play around but it makes things more complicated and the result is the same).
4. Voilą, all variables are gone. You can check using Print and any variable or you can simply click on "4. Weighting". If the bug appeared, there'll be no textboxes.
Edit: The Click2Select_Click Sub can be found in "Modul2".
Edit2: Just what I feared. After saving "ForTesting" and closing Excel, both files worked fine again. But after some time playing around, it started again. How is this possible?
Edit3: The problem is still occuring but I developed a routine to prevent it from having impacts. Attachement removed.
Bookmarks