When you have designed a userform with multiple controls such as textboxes, the user will probably want to navigate through in a logical order. If you’ve got hundreds of these controls, it is a laborious task to click on them and assign an incremental tabindex value from 1 to the end.
If your controls are named numerically (with a letter at the front which is necessary in Excel as a control can’t be just a number) then the example VBA code below will set the order on Userform Initialise, which is where the code will need to be pasted.
Let’s say you have 235 textboxes named P1, P2…P235 and the user will need to tab through these logically from 1 to the next. This is the code you need below. Feel free to drop us a message using the contact form or leave a comment below.
For i = 1 To 235
Me.Controls("P" & i).TabIndex = i - 1