I did this code to check for the value in a set of textbox control array with the value in another set of textbox control array. But this works only for the Enter key in the keyboard. Can this be working when we use the mouse to move to the next textbox?

Private Sub txtnewHr_KeyPress(Index As Integer, KeyAscii As Integer)
Dim TempVal As Long
TempVal = 0

If KeyAscii = 13 Then
If Index + 1 <= txtnewHr.Count Then
If T > Val(txtnewHr(Index).Text) Then
txtoldhr(Index).ForeColor = &H80000008
txtoldhr(Index).Text = Val(txtoldhr(Index).Text) + (T - Val(txtnewHr(Index).Text))
txtnewHr(Index + 1).SetFocus
ElseIf T <= Val(txtnewHr(Index).Text) Then
If Sgn(Val(txtoldhr(Index).Text)) = 1 Or Sgn(Val(txtoldhr(Index).Text)) = 0 Then
txtoldhr(Index).Text = txtoldhr(Index).Text - (Val(txtnewHr(Index).Text) - T)
txtoldhr(Index).ForeColor = &H80000008
If Index + 1 < txtnewHr.Count Then
txtnewHr(Index + 1).SetFocus
Else
cmdAdd.SetFocus
End If
End If
If Sgn(Val(txtoldhr(Index).Text)) = -1 Then
txtoldhr(Index).ForeColor = &HFF&
MsgBox "Exceeded Available Hours!", vbExclamation, "Alert!"
txtnewHr(Index).SetFocus
SendKeys "{Home}+{End}"
Exit Sub
End If
End If
End If
End If
End Sub

Please help.

Thanks