Help with combo box control decision

joemoore

New Member
Joined
Nov 20, 2004
Messages
21
In a form, I have a combox box that provides a list of choices. When one of the choices is selected (for example, "West"), I want the focus to move to a specific text box control on the form; when "East" is selected, I want the focus to move to a different text box control. I need to know how to make this happen. Can anyone help me? Thank you
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

SydneyGeek

MrExcel MVP
Joined
Aug 5, 2003
Messages
12,251
Assuming the combo is Combo0, and you want to select Taxt2 or Text4, this will work in the AfterUpdate event of the combo:
Code:
Private Sub Combo0_AfterUpdate()
Select Case Combo0.Value
    Case "East"
        Me.Text2.SetFocus
    Case "West"
        Me.Text4.SetFocus
End Select
End Sub

1. To go to the combo's event code, select the combo's Properties and click the Events tab. Double-click the blank After Update row so you see Event Procedure, then click the ... button at the end of the row to go to the code window.
2. Paste the code above (not including the Private Sub and End Sub lines) into the blank row in the combo's AfterUpdate procedure
3. Change the names of the controls to suit

If you need ot make more than 2 selections, you can expand the Select Case structure for the extra options.

Denis
 

Forum statistics

Threads
1,181,055
Messages
5,927,862
Members
436,573
Latest member
CMR237

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