Is it possible to find out which control in the Userform that has Focus?
Is it possible to find out which control in the Userform that has Focus?
Please Login or Register to view this content.
If your question has been satisfactorily addressed, please consider marking it solved. Click the Thread Tools dropdown and select Mark thread as solved.
Also, you might want to add to the user's reputation by clicking the star icon in the lower left corner of the post with the answer- it's why we do what we do...
Thomas Lafferty
Analyst/Programmer
Sorry, sorry!
I forgot to tell that the controls are on a Multipage and then the only reply by "Me.ActiveControl.Name" will be MultiPage1
Hello Mats Samson,
Add this function in the Declarations section of the UserForm. You can then call it from anywhere in your code. It returns the control with the focus.
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Star below the post.3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
try:Please Login or Register to view this content.
Hello!
Leith: I can't get your function to work, (even when exchanging x with SelCtrl)
Thomas: You're getting closer! As the controls are "grouped" in Frames, the reply is Frame415,
eg. the Frame where f.i. the TextBox is located.
Hello Mats Samson,
Did you copy the code to the top of your UserForm?
Did you call it like below? Remember, the function it is returning the control itself.
Please Login or Register to view this content.
Hello Leith,
thanks, it works OK!
I used MsgBox GetActiveControl (), not .....Name
Cheers
Mats
Hell Mats,
I am happy it something easy to fix. Thanks for letting me know what you did.
Leith,
is it possible to include named range(s) connected to the controls (text- & comboboxes) and take action in the connected cell depending on which control is in focus? The RowSource connection is made via the code, not in the control itself. (There are also a variable connected to each control, but as I understand variables cannot be referenced via concatenation)
Regards
Mats
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks