Tresfjording
New Member
- Joined
- Dec 14, 2019
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi ...
I'm trying to move the cursor one down and one to the left if the cursor i active in column G:G
I input numbers in columns F and G.
On ENTER in column F, I want the cursor to go to the same row in column G
On ENTER in column G, I want the cursor to go one row down, and one cell to the left from active cell.
That is, if i am typing a number in F34, upon ENTER the cursor wil go to G34
And upon ENTER in G34 it will select cell F35.
I have tried to do this in VBA and here is my feeble first try:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim colname As Integer
colnmbr = 7
If Columns.Select <> Columns(colnmbr) Then
Application.MoveAfterReturnDirection = xlToRight
Else
ActiveCell.Offset(1, -1).Select
End If
End Sub
The code returns an run-time error 13
I'm trying to move the cursor one down and one to the left if the cursor i active in column G:G
I input numbers in columns F and G.
On ENTER in column F, I want the cursor to go to the same row in column G
On ENTER in column G, I want the cursor to go one row down, and one cell to the left from active cell.
That is, if i am typing a number in F34, upon ENTER the cursor wil go to G34
And upon ENTER in G34 it will select cell F35.
I have tried to do this in VBA and here is my feeble first try:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim colname As Integer
colnmbr = 7
If Columns.Select <> Columns(colnmbr) Then
Application.MoveAfterReturnDirection = xlToRight
Else
ActiveCell.Offset(1, -1).Select
End If
End Sub
The code returns an run-time error 13