Dim TxtBx() As New Class1 'At the start of all code
Private Sub UserForm_Initialize()
Dim i As Long, ctrl As MSForms.Control
For Each ctrl In Me.Controls
If TypeName(ctrl) = "TextBox" Then
i = i + 1
ReDim Preserve TxtBx(i)
Set TxtBx(i).MultTextbox = ctrl
End If
Next
End Sub
Public WithEvents MultTextbox As MSForms.TextBox
Private Sub MultTextbox_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 39 Then SendKeys "{TAB}"
If KeyCode = 37 Then SendKeys "+{TAB}"
End Sub
Is there a way to highlight the textbox when moving
Public WithEvents MultTextbox As MSForms.TextBox
Private Sub MultTextbox_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = 39 Then SendKeys "{TAB}"
If KeyCode = 37 Then SendKeys "+{TAB}"
End Sub
Private Sub MultTextbox_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Dim xd, ctrl As MSForms.Control
xd = MultTextbox.Name
With UserForm1
For Each ctrl In .Controls
ctrl.BackColor = &H80000005
Next
.Controls(xd).BackColor = &HFF00&
End With
End Sub