Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and the Yahoo Answers website is now in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
VBA - Setting up a User Defined Class for Text Boxes?
I'm trying to get more efficient with my VBA programming, but I'm not the most proficient yet with declaring classes. I want to find out how I can create a user defined class of text boxes and trap the BeforeUpdate event for any text box pertaining to that class.
For example:
Let's say I have a user form with 20 text boxes. Half of those text boxes I want to only contain numbers greater than 0. So I create a text box class called clsNumTxtBxGT0, then I make those ten text boxes for numbers greater than zero all that class of text box. Once I've done that, I want to trap the BeforeUpdate event. So if a user tries to update any one of those text boxes it brings up a message box that states the entry has to be a number greater than zero. Then the text box value is reset to blank and afterwards the Cancel argument of BeforeUpdate is set to True so that the cursor doesn't move to the next object so the user can easily re-enter their data.
I'm hoping that there is a way I can define a class of text boxes. Then use that class to detect if ANY of those text boxes of that class have been updated with the BeforeUpdate event. I'm wanting to avoid writing code in the BeforeUpdate event of EVERY text box. Instead, I wanted to write one small Sub that gets used for all of those text boxes.
Please don't suggest using a Call procedure in the BeforeUpdate event of each text box. I know how to do that an that still requires putting some code in for every text box.
Thanks!
2 Answers
- garbo7441Lv 71 decade agoFavorite Answer
Hi Devilish...
I think Ozgrid has something for you:
http://www.ozgrid.com/forum/showthread.php?t=80631...
Probably have to adapt it a bit...
- 1 decade ago
i am sorry. because ask u a question. my 15 days old baby rabbit died yesterday. another also sick. their mother also sick (diarrhea), 3 days. but i don't understand why they gonna die. plz help me . there are no vet. i know u r a Expert in rabbit raising. i am helpless. plz help me.