How can I keep selected a textbox every time I open the UserForm ?

fabber

New Member
Joined
Aug 31, 2010
Messages
2
Hello guys.
I have 1 UserForm with 2 TextBoxs and 1 CommandButton.
The CommandButton hides the UserForm. Every time I open the UserForm I would like to have textbox1 activated (I mean ready for typing in).
The problem is that it happens the first time only because when I use CommandButton on the userform (which hides the userform) and I open userform again the selection is on the CommandButton.
How can I keep selected textbox1 everytime I open the UserForm regardless whatever is the last operation I do on the UserForm?
I hope my question was clear.
Thankx

Fabber
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Assuming your userform is called "Form1", in the code to show the form add the line

Code:
Form1.TextBox1.SetFocus
 
Upvote 0

Forum statistics

Threads
1,213,536
Messages
6,114,202
Members
448,554
Latest member
Gleisner2

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