![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Here is a system I use. It evaluates each key stroke as the user types it in. If the key stroke is a number then nothing happens, but if the keystroke is a letter or it will remove give an error message and remove the keystroke.
I have created an example code for a UserFrom with two textboxes...you can incorporate into your code.
To test create a UserForm with two textboxes named TextBox1 and TextBox2 and copy and paste the following code into it.
![]()
Please Login or Register to view this content.
If your questions has been answered to your satisfaction please don't forget to do the following:
Add Reputation ... and ... Mark Thread as Solved
Thanks,
Ma 10:8b Freely you have received; freely give.
Hello,Cplettner,
Thank you for your answer.
Nice, it works, but is it possible to join all textboxes in just one code? That´s because I have an userform with 30 textboxes, and so, the code would be very large.
Sorry for insist, I'd be very grateful
This is the most that can be done...unfortunately you will need a separate change event for all text boxes there is no way around that to my knowledge.
![]()
Please Login or Register to view this content.
Hello cplettner
Tankyou very much, it works very well. Thank again
Carlos
You are welcome!
Please Add Reputation if you are satisfied and mark the thread as "Solved"
Hi jdasp49
You can do this by introducing a Class Module
See attached for an example.is it possible to join all textboxes in just one code
John
If you have issues with Code I've provided, I appreciate your feedback.
In the event Code provided resolves your issue, please mark your Thread as SOLVED.
If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.
Awesome @jaslake! Thanks for the tip!
Based on a request by @YasserKahlil...to only allow one period (".") in the text box
Change
To![]()
Please Login or Register to view this content.
I think![]()
Please Login or Register to view this content.
@YasserKahlil
Play with this in the Class Module...there's a better way but I'm using the OP's Code...
![]()
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks