Tab out of a UserForm > ListBox ?

CrashDDL

Board Regular
Joined
Oct 17, 2016
Messages
66
Hi,

As the title says. How can I "Tab" out of a ListBox on a UserForm?
I don't understand why, the ".SetFocus" will move cursor to "ListBox2" but focus jumps back after "End Sub".
Anyone has a suggestion for this?

VBA Code:
Private Sub ListBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)

    If KeyCode = 9 Then ListBox2.SetFocus

End Sub
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Sorry for the late reply, it was so late I fell asleep. So the UserForm is triggered on the main page of the Workbook when price or qty is changed to start the recording of a sale. When a second item is created by upgrading the base item, the UserForm looks up the possible upgrades from the specific account the base item is from. User then selects the used parts and with Enter continues the archiving of the trade. At this point the code will calculate itemCost, itemProfit etc and store it all on the Sold sheet. It is a bit more complicated than that but that would be the jist of it.

I already thought of KeyUp event just did not get around to change it yet, was so focused on the problem with Tab. I will test it out and identify the bit of code that causes the issue.
 
Upvote 0

Forum statistics

Threads
1,214,611
Messages
6,120,510
Members
448,967
Latest member
screechyboy79

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