Combobox is highlighted when loading userform... -- SendKeys ("{TAB}") --

MistakesWereMade

Board Regular
Joined
May 22, 2019
Messages
103
I have a userform that I load but the combobox is selected... I don't want the cursor blinking in my combobox when the userform is opend. I currently use sendkeys for Tab as it will move the selection to the next button which is fine. Is there a different way to code this rather than having to rely on the sendkeys command?

My code is below:

Code:
Private Sub CommandButton1_Click()


UserForm1.Show vbModeless
SendKeys ("{TAB}")


End Sub
 
Last edited:

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
No code needed.

Go into your form design and adjust your "TabStop" (True/False...Tab either CAN find it or WONT find it based on this) and then of course adjust your Tab Index. Lowest number gets first focus. So be sure the combobox is NOT the lowest Tab Index.

Enjoy.


(and in case it isnt clear...When the user hits 'Tab', it will cycle through ALL objects (with a tab stop set to TRUE) in the sequential order..Tab Index 0, then 1, then 2, then 3...so on and so forth..

When it reaches its highest Tab index, it will cycle back to the lowest and start all over.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,376
Messages
6,119,175
Members
448,870
Latest member
max_pedreira

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