See attached Excel sheet.
I have a userform in the attached workbook, but I removed almost all the code except the code in question to keep it simple. A nice person on the forum helped me with a problem where I didn't want the user to be able to navigate away from a textbox if the entry was out of a certain range, in this case 1 to 100. He/She gave me the following code:
The code works, but ONLY if my textbox1 is NOT in a frame. When I made textbox1, I put it and its corresponding spinbutton outside of a frame, and the code works when I hit the little play button. If I enter a number (I used 200), it won't let me click away until I enter a number 1 to 100. But when I dragged textbox1 and the corresponding spinbutton into Frame 8 just below it and ran the code, I'm able to navigate away from an invalid entry (I used 200).
Why does it matter if textbox1 is in a frame or not? I want to use frames to organize the userform, so how do I get the code to work inside of a frame? Thoroughly confused after 2 hours of fiddling and figuring out that it was the frame causing the problem in the first place.
Thanks for your time.
Bookmarks