How do I place cursor into TextBox or CombBox?

HvyEquipment

New Member
Joined
Apr 19, 2004
Messages
11
Hopefully, this is an easy question:

I have a sequence of textboxes and comboboxes on a userform and I would like to make one of the textboxes active (ie cursor blinking in that textbox ready to accept user input) based upon the combobox selection.

For example:

Combobox1 items = Text1, Text2 & Text3

Select Text2 from the Combobox1 and the cursor needs to move to Text2 and wait on the user to input text.

For whatever reason, I cannot figure out how to do this, can anyway please steer me in the right direction?
 

Some videos you may like

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.

hatman

Well-known Member
Joined
Apr 8, 2005
Messages
2,664
something like this, i would think
Code:
Private Sub ComboBox1_Change()

    Dim item As MSForms.Control

    For Each item In Me.Controls
    
        If item.Name = Me.ComboBox1.Value Then
        
            item.SetFocus
            
        End If
    
    Next item
    

End Sub
 

Watch MrExcel Video

Forum statistics

Threads
1,111,596
Messages
5,541,154
Members
410,543
Latest member
ExcelGlenn
Top