This is a two pronged question.
Firstly, when someone tabs and it shifts focus to either G15 or G16, I want them to be moved to another cell.
The second part is that I wonder how this can be shortened so that G15 goes to C16 and G16 goes to C20.
Thank you.
EDIT:
Missed out some information:
Firstly, when someone tabs and it shifts focus to either G15 or G16, I want them to be moved to another cell without the user seeing focus first go to G15 or G16. That should be invisible and when tabbing, it should go appear to go to C16 or G16 immediately.
Firstly, when someone tabs and it shifts focus to either G15 or G16, I want them to be moved to another cell.
The second part is that I wonder how this can be shortened so that G15 goes to C16 and G16 goes to C20.
VBA Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
Const sCELL_TO_SKIP As String = "G15:G16" 'Stop user selecting G16
Const sJUMP_TO_CELL As String = "C16" 'Move user to C16
Dim rCellToSkip As Range
Set rCellToSkip = Me.Range(sCELL_TO_SKIP)
If Not Intersect(Target, rCellToSkip) Is Nothing Then
Application.EnableEvents = True
Me.Range(sJUMP_TO_CELL).Activate
End If
End Sub
Thank you.
EDIT:
Missed out some information:
Firstly, when someone tabs and it shifts focus to either G15 or G16, I want them to be moved to another cell without the user seeing focus first go to G15 or G16. That should be invisible and when tabbing, it should go appear to go to C16 or G16 immediately.
Last edited by a moderator: