Forum Discussion
Combining the power of goal seek and scenario analysis in a VBA Userform
- Apr 22, 2024The Exit event does not allow setting focus, best use the Change event.
JKPieterse Sorry for my delayed response. I took some time to try out a few of your ideas to get rid of the message boxes and refactor the code a bit. I've attached the working file to this message. Since my origional message I've taken a new approach. Each refEdit control will have a series of data validations run upon exiting the control. The hope was that by putting controlName.SetFocus in the sub controlName_Exit(), the user would not be able to hit return or tab to move to the next control until a valid entry is given. However, this does not work, and you can try the mechanics for yourself. I currently have only built out the refEdit control for setCell, but hopefully the direction of the program is clear.
- JKPieterseApr 22, 2024Silver ContributorThe Exit event does not allow setting focus, best use the Change event.
- Riley_JohnsonApr 23, 2024Copper Contributor
JKPieterse That's unfortunate. I've given up on locking the user in a refEdit control for now.
On a brighter note, I have been using the _change() event, and one of the features that I've enjoyed is the live updates that it gives when moving across cells (as long as the user does not use their mouse).