ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform question (https://www.excelbanter.com/excel-programming/431337-userform-question.html)

Gary Keramidas

userform question
 
have 2 fields on a user form. when textbox1 is exited, it looks up the value
and stores it in a variable. if i don't find it, i pop a message box but i'm
having a problem setting the focus back to textbox1. it always goes to
textbox2 even thought i set focus back to textbox1.

what's the best way to only go to textbox 2 if it finds the value entered
into textbox1, otherwise clear textbox1 and set the focus.

unloading and loading the form works, but just looking for a better way.
--

Gary Keramidas
Excel 2003



Gary Keramidas

userform question
 
i just added
if me.textbox1.value = "" then me.textbox1.setfocus

into a textbox2_enter procedure and it seems to work.

any better ideas?

--

Gary Keramidas
Excel 2003


"Gary Keramidas" <GKeramidasAtMSN.com wrote in message
...
have 2 fields on a user form. when textbox1 is exited, it looks up the
value and stores it in a variable. if i don't find it, i pop a message box
but i'm having a problem setting the focus back to textbox1. it always
goes to textbox2 even thought i set focus back to textbox1.

what's the best way to only go to textbox 2 if it finds the value entered
into textbox1, otherwise clear textbox1 and set the focus.

unloading and loading the form works, but just looking for a better way.
--

Gary Keramidas
Excel 2003





All times are GMT +1. The time now is 10:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com