vba Code: How to STOP the user on a specific TextBox to post a value

Bib195

New Member
Joined
Dec 14, 2024
Messages
19
Office Version
  1. 365
Platform
  1. Windows
Hello Everybody.
I have a running UserForm where I want to Force the User to post a value to a Specific TextBox and can't continue even pressing Enter or Space, etc... Also, which event to use to evaluate the User entry, as I tried [AfterUpdate} & {Change} and both didn't evaluate the entry specially when the user press Enter on the TextBox.
Any value must be entered into the TeaxtBox to continue. I appreciate your Help
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Typically (as it seems you have some experience already with VBA), I would suggest at the time they press <ENTER>, your code will then evaluate the specific TextBox to see if they entered the value or not. If they did not, then you repeat, and throw up the UserForm again.

Usually users get the message (but you can add another text box with the reasoning also for intuitive user experience).

Cheers
Rob
 
Upvote 0
Typically (as it seems you have some experience already with VBA), I would suggest at the time they press <ENTER>, your code will then evaluate the specific TextBox to see if they entered the value or not. If they did not, then you repeat, and throw up the UserForm again.

Usually users get the message (but you can add another text box with the reasoning also for intuitive user experience).

Cheers
Rob
Thanks Rob for your quick response,
Actually I'm not experience with vba at all, just writing very basic commands.
Referring back to your reply, I have 2 questions:
1- in which event do I check for the "Enter" key pressed, i.e. AfterUpdate( ), Change( ), etc... knowing that Pressing "Enter" on the TBox doesn't trigger these events.
2- how exactly to check for "Enter" Key.
Regarding messaging the User, I have created a specific User-Messaging form that looks more sexy than Excel MsgBox function. So, I have my own way to communicate with the Users.
I guess now you will realize that I don't have any VBA experience at all. 😂😂. I do appreciate your help.
Ehab.
 
Upvote 0
Hi Ehab,

Its great you have managed to create such a sexy form, with your macros attached. In case it can be useful for you, here's a link to some basic UserForm interactions, by way of an example. It might help you understand where you need to play within your own code.


Hope it helps

Rob
 
Upvote 0
Hi Ehab,

Its great you have managed to create such a sexy form, with your macros attached. In case it can be useful for you, here's a link to some basic UserForm interactions, by way of an example. It might help you understand where you need to play within your own code.


Hope it helps

Rob
Thank you Rob, but I'm already Subscribes to this Page and unfortunately it doesn't have an answer to my question above!
 
Upvote 0

Forum statistics

Threads
1,225,738
Messages
6,186,736
Members
453,369
Latest member
juliewar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top