Forum Discussion
MikeWells13
Jan 26, 2023Copper Contributor
Jump to specific cell after pressing enter
Hi all, Is there a way to force Excel to jump to a specific cell after pressing enter? I have 2 columns of data that I'd like to alterate between quickly, i.e. A2, then D2, then A3, then D3, ...
MikeWells13
Feb 05, 2023Copper Contributor
So I managed to find a way that sort of worked:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim aTabOrd As Variant
Dim i As Long
aTabOrd = Array("W10", "Z10", "W11", "Z11", "W12", "Z12")
For i = LBound(aTabOrd) To UBound(aTabOrd)
If aTabOrd(i) = Target.Address(0, 0) Then
If i = UBound(aTabOrd) Then
Me.Range(aTabOrd(LBound(aTabOrd))).Select
Else
Me.Range(aTabOrd(i + 1)).Select
End If
End If
Next i
End Sub
This works well when entering data, moving to the next cell when I press enter.
However, if I undo because I've made a mistake, the the tab order will skip to the next cell as if the order hadn't stopped. Any suggestions?
Private Sub Worksheet_Change(ByVal Target As Range)
Dim aTabOrd As Variant
Dim i As Long
aTabOrd = Array("W10", "Z10", "W11", "Z11", "W12", "Z12")
For i = LBound(aTabOrd) To UBound(aTabOrd)
If aTabOrd(i) = Target.Address(0, 0) Then
If i = UBound(aTabOrd) Then
Me.Range(aTabOrd(LBound(aTabOrd))).Select
Else
Me.Range(aTabOrd(i + 1)).Select
End If
End If
Next i
End Sub
This works well when entering data, moving to the next cell when I press enter.
However, if I undo because I've made a mistake, the the tab order will skip to the next cell as if the order hadn't stopped. Any suggestions?