Selecting a certain cell

B

Bernd

Hi!
I don´t get it although it seemd to be so simple.
I want that after I entered a word in column A1 the cursor selects B1 and
after that A2 (and so on: B2-A3-B3...)

I tried it with this code but there seems to be a problem with the default
cursor movement. Who can help?

Many thanks
Bernd

Sub auto_open()
Application.OnEntry = "start"
End Sub

Sub start()
If ActiveCell.Column = 1 Then
Cells(ActiveCell.Row, ActiveCell.Column + 1).Select
Else
If ActiveCell.Column = 2 Then
Cells(ActiveCell.Row + 1, ActiveCell.Column - 1).Select
End If
End Sub
 
P

Patrick Molloy

use the sheet's change event:
Right click the sheet tab & select "View Code"
Add This:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row = 1 Then
Target.Offset(1, 0).Select
ElseIf Target.Row = 2 Then
Target.Offset(-1, 1).Select
End If
End Sub

HTH
Patrick Molloy
Microsoft Excel MVP
 
D

Don Guillett

IF I understand what you want, if in col A you want to goto col B and if in
col B you want to goto A one cell down. If so
Right click on the sheet tab>view code>insert this>save
As written it won't work in the 1st 3 rows

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Row > 3 And Target.Column = 1 Then ActiveCell.Offset(0, 1).Select
If Target.Row > 3 And Target.Column = 2 Then ActiveCell.Offset(1, -1).Select
End Sub
 
B

Bernd

Great!

Many thanks
Bernd

Don Guillett said:
IF I understand what you want, if in col A you want to goto col B and if in
col B you want to goto A one cell down. If so
Right click on the sheet tab>view code>insert this>save
As written it won't work in the 1st 3 rows

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Row > 3 And Target.Column = 1 Then ActiveCell.Offset(0, 1).Select
If Target.Row > 3 And Target.Column = 2 Then
ActiveCell.Offset(1, -1).Select
 
G

Gord Dibben

Bernd

As an alternative to Macro solution.......

Select Columns A and B then Format>Cells>Protection> uncheck "locked".

Tools>Protection>Protect Sheet.

Use the TAB key when entering data in A1 to go to B1, A2, B2 etc.

Gord Dibben XL2002
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top