I am currently stumped trying to dynamically change the TabIndex and TabStop values for multiple Textboxes on my userform frmSalesEbay.
Why doesn't this code succeed?
There are Textboxes in three Frames, Frame1, Frame3, Frame4. Can this be an/the problem?
User clicks a CommandButton. Macro successfully adjusts which Textboxes are Visible = True/False and Enabled = True/False. Macro does not successfully adjust TabStop = True/False nor TabIndex = x.
If x = 1 Or x = 3 Or x > 4 And x < 20 Or x = 26 Or x = 30 Then
With frmSalesEbay.Controls("TextBox" & x)
.Visible = True
.Enabled = True
If x = 5 Then
.TabStop = True
.TabIndex = 0 (or appropriate digit for location on form)
End If
End With
End if
How can I dynamically change the TabStop and TabIndex values? I have found code snippets online and attempted to adapt them but without success yet.
This is one. It doesnt set TextBox30 TabIndex to zero.
Sub tabset()
'tabset
Dim i As Integer
For i = 1 To 30
If i = 30 Then
frmSalesEbay.Controls("TextBox" & i).TabIndex = i - 1
End If
Next i
End Sub
I have searched for, read and tried multiple "How to programmatically set TabIndex for UserForm Controls. None have worked for me.
Your guidance will be greatly appreciated
Why doesn't this code succeed?
There are Textboxes in three Frames, Frame1, Frame3, Frame4. Can this be an/the problem?
User clicks a CommandButton. Macro successfully adjusts which Textboxes are Visible = True/False and Enabled = True/False. Macro does not successfully adjust TabStop = True/False nor TabIndex = x.
If x = 1 Or x = 3 Or x > 4 And x < 20 Or x = 26 Or x = 30 Then
With frmSalesEbay.Controls("TextBox" & x)
.Visible = True
.Enabled = True
If x = 5 Then
.TabStop = True
.TabIndex = 0 (or appropriate digit for location on form)
End If
End With
End if
How can I dynamically change the TabStop and TabIndex values? I have found code snippets online and attempted to adapt them but without success yet.
This is one. It doesnt set TextBox30 TabIndex to zero.
Sub tabset()
'tabset
Dim i As Integer
For i = 1 To 30
If i = 30 Then
frmSalesEbay.Controls("TextBox" & i).TabIndex = i - 1
End If
Next i
End Sub
I have searched for, read and tried multiple "How to programmatically set TabIndex for UserForm Controls. None have worked for me.
Your guidance will be greatly appreciated