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?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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
 
Upvote 0

Forum statistics

Threads
1,214,826
Messages
6,121,797
Members
449,048
Latest member
greyangel23

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