UserForm Textbox.visible tab order doesn't work

03856me

Active Member
Joined
Apr 4, 2008
Messages
297
I have a userform with textboxes/labels that are hidden unless certain choices are made in a combobox. The code is working as expected with one exception: The exit event triggers the correct boxes to become visible and clears and hides the right ones - in the tab order they are directly after the combo box - but the focus is not on the now visible one. I have the code in an exit event, I also tried AfterUpdate event but it works the same way. This code basically ignores the tab order. What am I missing?

Code:
Private Sub cbo_machctr_Exit(ByVal Cancel As MSForms.ReturnBoolean)
    cbo_machctr.BackColor = &HFFFFFF
    If cbo_machctr.Value = "Boiler" Then
        Me.lbl_function.Visible = True
        Me.cbo_boilerfunction.Visible = True
        Me.cbo_kilnfunction.Value = ""
        Me.cbo_kilnfunction.Visible = False
    Else
        If cbo_machctr.Value = "Kiln" Then
            Me.lbl_function.Visible = True
            Me.cbo_kilnfunction.Visible = True
            Me.cbo_boilerfunction.Value = ""
            Me.cbo_boilerfunction.Visible = False
        Else
            Me.lbl_function.Visible = False
            Me.cbo_boilerfunction.Visible = False
            Me.cbo_kilnfunction.Visible = False
        End If
    End If
End Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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