VBA: Detect changes in any textbox of the userform
问题 There is a userform that has many textboxes and I need to detect changes in each. So I have write a subroutine for every textbox in the form and it turns out a large piece of code. As the code for every textbox is the same I want to optimize it. So is it possible to write just one subroutine that detect changes in any textbox of the form? 回答1: The only way do achieve that is to use a class along with WithEvents Here's a minimal example: Code for the class module named mytextbox : Private