Forum Discussion
Riley_Johnson
Apr 15, 2024Copper Contributor
Combining the power of goal seek and scenario analysis in a VBA Userform
I’m building a userform (and a module) for a more flexible Goal Seek. I’ve had recurring uses for something like this at work, where I need Goal Seek’s functionality mixed in with some “what if analy...
- Apr 22, 2024The Exit event does not allow setting focus, best use the Change event.
JKPieterse
Apr 16, 2024Silver Contributor
Can you provide the actual Excel file with the code? I'm not too happy to invest time in duplicating your setup from a couple of screenshots and I bet neither are others who might be able to help.
Riley_Johnson
Apr 21, 2024Copper Contributor
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.