On Userform move cursor position to different textbox based on value in another textbox

  • I have a UserForm with several TextBoxes. What I'm trying to accomplish is to move the cursor to TextBox7Quantity if the value in TextBox2 = "FOB". The Code below is in the Change Event of TextBox51. When I run the Userform and key in the data the Cursor moves to the next Textbox in the Tab Order rather than to TextBox7Quantity . Any help would be greatly appreciated.

    1. Private Sub TextBox51_Change()
    2. If TextBox2 = "FOB" Then
    3. Me.TextBox7Quantity.SetFocus
    4. End If
    5. End Sub