How to move from one control to another in a form on worksheet @Exceltrainingvideos
How to move from one control to another in a form on worksheet  @Exceltrainingvideos
Uploaded September 2019 | Updated September 2026, 1 week ago
How to move from one control to another in a form on a worksheet using tab and shift keys coded with VBA. Here's the code for each control:
Private Sub cboItemName_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = vbKeyTab Then
Me.cboMfg.Activate
End If

End Sub

Private Sub cboMfg_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Shift = 0 And KeyCode = vbKeyTab Then
Me.txtBatchNo.Activate

ElseIf Shift = 1 And KeyCode = vbKeyTab Then
Me.cboItemName.Activate
End If

End Sub

Private Sub txtBatchNo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Shift = 0 And KeyCode = vbKeyTab Then
Me.txtExpiryDate.Activate
ElseIf Shift = 1 And KeyCode = vbKeyTab Then
Me.cboMfg.Activate
End If
End Sub

Private Sub txtExpiryDate_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Shift = 0 And KeyCode = vbKeyTab Then
Me.txtMRP.Activate
ElseIf Shift = 1 And KeyCode = vbKeyTab Then
Me.txtBatchNo.Activate
End If
End Sub

Private Sub txtMRP_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Shift = 0 And KeyCode = vbKeyTab Then
Me.txtPurchaseDate.Activate
ElseIf Shift = 1 And KeyCode = vbKeyTab Then
Me.txtExpiryDate.Activate
End If
End Sub

Private Sub txtPurchaseDate_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Shift = 0 And KeyCode = vbKeyTab Then
Me.txtQty.Activate
ElseIf Shift = 1 And KeyCode = vbKeyTab Then
Me.txtMRP.Activate
End If
End Sub

Private Sub txtQty_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If Shift = 1 And KeyCode = vbKeyTab Then
Me.txtPurchaseDate.Activate
End If
End Sub
Details also available on our website: exceltrainingvideos.com/move-from-one-control-to-another-in-a-form-on-worksheet
How to move from one control to another in a form on worksheetAutomate Copying of Master Worksheet || 2021Extract Data from Word Document Using Word and Excel VBACalendar Control for All Office versionsFilter Data into Listbox using two Combo-boxes data as CriteriaAutomatically Pop-Up Find Dialog BoxSort Worksheet Tabs By ColorGenerate Random Strings in Excel with VBADisplay Data in Listbox based on Combo Box SelectionCreate Floating ButtonForward Message via whatsapp DesktopSpeed Up Macros
Dinesh Kumar Takyar |

How to move from one control to another in a form on worksheet

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER