Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

combobox select

ResolvedVersion 2003

Ziggy has attended:
Excel VBA Intro Intermediate course
Excel VBA Advanced course

ComboBox Select

Hello

Very quick one (I think) but cant find a sensible answer anywhere.

I have an embedded combobox, after I run a reset procedure I would like the combobox field to be active so that I may use the arrow keys to navigate.

Currently I have to click in the box (not a HUGE problem but not tidy). (I also have a similar problem with another set of comboboxes, where after selecting in one I would like the second to be active in the fashion described above.)

Sheets("Name").cboName.Select

Selects the combobox as if editing.

Sheets("Name").cboName.Dropdown

Opens the dropdown (which is even worse).

I just wish for the cursor to be "flashing" in the box.

Any help would be great.

Many thanks

Ziggy

RE: ComboBox Select

Hi Ziggy, thanks for your query. Select the Combobox on the form and in the properties panel set its TabIndex value to 0. When the form is run the cursor should be flashing in the ComboxBox. Note you can also access the TabIndex property in code.

Hope this helps,

Anthony

RE: ComboBox Select

Hello Anthony

Thank you for such a swift reply.

However, as I think I mentioned in the original message the combobox is embedded (i.e. in a sheet).
It is created with the whole sheet when a button is clicked. It is at the end of this process that I would like the cursor to be in the combobox. (so basically the line of code that would do the action described in your reply.... see original message for the things I have already tried).

Many thanks

Ziggy

RE: ComboBox Select

Hi Ziggy. Try:

Sheets("Sheet1").ComboBox1.Activate

Hope this helps,

Anthony

RE: ComboBox Select

Hello Anthony

Sorry for the delayed response, I have been away on business.

Your solution was absolutely perfect.

Thank you.

Ziggy

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Multiple Lines of Text in a Cell

As an alternative to the Text Wrapping facility, type a word or two, press Alt+Enter to get a new line, type more text, and continue the process for as many lines as you need. Enter as normal when you have finished.

The line break is not affected by changing the column width, as text wrapping. To remove this you must edit the cell and remove the invisible character and replace with a normal space.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.