So, the following code has a form that has a display feature on both listboxes if certain criteria is met based on user input, then it selects the last entry to get the value of "Code" number, with case statement I called the next letter based on the value of lbCode listbox. The issue I have here is that I sometimes get the Code value from the listbox but sometimes I don't, even if I run the same search criteria without adding anything to the list. This happens when I close the file and open it again and save it on exit dialog, or just sometimes at random. I can't find the root cause, like I said, it works and doesn't sometimes. I sometimes thought that if I ran it from the vba menu it would work but it would also work from the button on the excel file itself.
Bookmarks