Transferring focus?

LufiaMaxim

New Member
Joined
Jul 13, 2011
Messages
16
Hello all,

I'll try to make this as simple as can be.

I have a textbox (ActiveX control) with a button (also ActiveX) next to it. Currently, I validate the textbox's contents with the textbox's LostFocus event. Works great.

However, with some testing and playing around, I noticed a behaviour I would like to prevent. Basically, it goes like this: If user was in the textbox, and then clicked on the button next to it, do NOT run the validation code (which is its own separate sub).

What's the best way to accomplish this? If I use the button's GetFocus event, can I somehow see where the last focus was?

I'm thinking of accomplishing this with a timer delay, but it seems a rather ... well, inefficient work-around. If I could somehow get the last focus in the button's GetFocus event, that would make things easiest.

What's best way of accomplishing this?
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.

Forum statistics

Threads
1,224,505
Messages
6,179,152
Members
452,891
Latest member
JUSTOUTOFMYREACH

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