UserForm textbox in focus with cursor. How?

vandan

New Member
Joined
Oct 8, 2002
Messages
4
This seems like a real beginner question but i have not been able to find the answer. i have a User form that has 1 textbox and 3 buttons. What i would like is that when the UserForm is launched that the textbox be in focus with the cursor ready. i can have the textbox in focus but the part that i can not do is have the cursor ready. i want to launch the UserForm and be able to start typing without having to select the textbox with the mouse.
thanks for you help,
Dan.
 

Some videos you may like

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Hi Vandan. Welcome to the board.

Try this

Private Sub Workbook_Open()
UserForm1.Show
UserForm1.TextBox1.SetFocus
End Sub
 

vandan

New Member
Joined
Oct 8, 2002
Messages
4
the setfocus command is what i was using it will put the textbox in focus but it will not give me the cursor. any ideas?
Dan.
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092

ADVERTISEMENT

It works for me - I get a flashing vertical cursor.
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Works fine for me too. Maybe you should check the TextBox Properties.
 

vandan

New Member
Joined
Oct 8, 2002
Messages
4
i tried it in a new worksheet with a new userform and it does work it must be something that i am doing in the userform code to lose focus i will work on it thanks.
Dan.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,517
Messages
5,596,620
Members
414,081
Latest member
Subaru_Steve

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
Top