ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   move cursor (https://www.excelbanter.com/excel-programming/341117-move-cursor.html)

Peter[_55_]

move cursor
 
Hi,

Is it possible that, when you hit the enter button, the cursor moves to a
cell specified by me?
For instance:
A1 =="enter" ==G4



Tom Ogilvy

move cursor
 
No matter where the activecell is, if the user hits enter, you want to go to
G4?

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

Is it possible that, when you hit the enter button, the cursor moves to a
cell specified by me?
For instance:
A1 =="enter" ==G4





Peter[_55_]

move cursor
 
No, the activecell is specified.
It's like the textbox- taborder in a userform, you know what i mean?
"Tom Ogilvy" schreef in bericht
...
No matter where the activecell is, if the user hits enter, you want to go
to
G4?

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

Is it possible that, when you hit the enter button, the cursor moves to a
cell specified by me?
For instance:
A1 =="enter" ==G4







Tom Ogilvy

move cursor
 
Select the cells in the order you want to travel through them. Then leave
them selected.

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
No, the activecell is specified.
It's like the textbox- taborder in a userform, you know what i mean?
"Tom Ogilvy" schreef in bericht
...
No matter where the activecell is, if the user hits enter, you want to

go
to
G4?

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

Is it possible that, when you hit the enter button, the cursor moves to

a
cell specified by me?
For instance:
A1 =="enter" ==G4









Tom Ogilvy

move cursor
 
Just to clarify.
Use the mouse and the control key to select the cells in the order you want
to nagivate through them (so that all the cells of interest are selected).
then leave them selected.

Now use the enter/return key to travel through them.

--
Regards,
Tom Ogilvy


"Peter" wrote in message
...
No, the activecell is specified.
It's like the textbox- taborder in a userform, you know what i mean?
"Tom Ogilvy" schreef in bericht
...
No matter where the activecell is, if the user hits enter, you want to

go
to
G4?

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

Is it possible that, when you hit the enter button, the cursor moves to

a
cell specified by me?
For instance:
A1 =="enter" ==G4









Peter[_55_]

move cursor
 
Hi again Tom,

That was something i knew, but it is not what i meant.
I'm going to try to give you an example of what i want.

in a vba code:
A1 = G5 = E3 = K10 = F2
when A1 is selected and enter is hit move to cell G5
when E3 is selected and enter is hit move to cell K10
when................and so on

The starting cell is a single selected cell, the end cel is the next cell
that has been written in the code.

I don't want all the cells selected at the same time, i'm just looking for a
taborder to move from one cell to another.

Regards,
Peter


"Tom Ogilvy" schreef in bericht
...
Just to clarify.
Use the mouse and the control key to select the cells in the order you
want
to nagivate through them (so that all the cells of interest are selected).
then leave them selected.

Now use the enter/return key to travel through them.

--
Regards,
Tom Ogilvy


"Peter" wrote in message
...
No, the activecell is specified.
It's like the textbox- taborder in a userform, you know what i mean?
"Tom Ogilvy" schreef in bericht
...
No matter where the activecell is, if the user hits enter, you want to

go
to
G4?

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

Is it possible that, when you hit the enter button, the cursor moves
to

a
cell specified by me?
For instance:
A1 =="enter" ==G4











Tom Ogilvy

move cursor
 
Just use the selectionchange event to record (update a static variable) the
last activecell (it already tells you the cell selected). Test if the last
active cell was one of the ones you are interested in, and if so, then
change the selection to the next cell you want selected. Make sure you
disable events so you don't go into an endless loop.

so as an example, right click on the sheet tab and select view code. Put in
code like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static oldCell As Range
If Not oldCell Is Nothing Then
Debug.Print oldCell.Address
Select Case oldCell.Address(0, 0)
'A1 = G5 = E3 = K10 = F2
Case "A1": sStr = "G5"
Case "G5": sStr = "E3"
Case "E3": sStr = "K10"
Case "K10": sStr = "F2"
Case "F2": sStr = "A1"
Case Else: sStr = ""
End Select
If sStr < "" Then
Application.EnableEvents = False
Range(sStr).Select
Application.EnableEvents = True
End If
End If
Set oldCell = ActiveCell

End Sub

--
Regards,
Tom Ogilvy



"Peter" wrote in message
...
Hi again Tom,

That was something i knew, but it is not what i meant.
I'm going to try to give you an example of what i want.

in a vba code:
A1 = G5 = E3 = K10 = F2
when A1 is selected and enter is hit move to cell G5
when E3 is selected and enter is hit move to cell K10
when................and so on

The starting cell is a single selected cell, the end cel is the next cell
that has been written in the code.

I don't want all the cells selected at the same time, i'm just looking for

a
taborder to move from one cell to another.

Regards,
Peter


"Tom Ogilvy" schreef in bericht
...
Just to clarify.
Use the mouse and the control key to select the cells in the order you
want
to nagivate through them (so that all the cells of interest are

selected).
then leave them selected.

Now use the enter/return key to travel through them.

--
Regards,
Tom Ogilvy


"Peter" wrote in message
...
No, the activecell is specified.
It's like the textbox- taborder in a userform, you know what i mean?
"Tom Ogilvy" schreef in bericht
...
No matter where the activecell is, if the user hits enter, you want

to
go
to
G4?

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

Is it possible that, when you hit the enter button, the cursor moves
to

a
cell specified by me?
For instance:
A1 =="enter" ==G4













Peter[_55_]

move cursor
 
Thanks Tom,

That was exactly what i was looking for.
You're the best.

Greets,
Peter
"Tom Ogilvy" schreef in bericht
...
Just use the selectionchange event to record (update a static variable)
the
last activecell (it already tells you the cell selected). Test if the
last
active cell was one of the ones you are interested in, and if so, then
change the selection to the next cell you want selected. Make sure you
disable events so you don't go into an endless loop.

so as an example, right click on the sheet tab and select view code. Put
in
code like this:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static oldCell As Range
If Not oldCell Is Nothing Then
Debug.Print oldCell.Address
Select Case oldCell.Address(0, 0)
'A1 = G5 = E3 = K10 = F2
Case "A1": sStr = "G5"
Case "G5": sStr = "E3"
Case "E3": sStr = "K10"
Case "K10": sStr = "F2"
Case "F2": sStr = "A1"
Case Else: sStr = ""
End Select
If sStr < "" Then
Application.EnableEvents = False
Range(sStr).Select
Application.EnableEvents = True
End If
End If
Set oldCell = ActiveCell

End Sub

--
Regards,
Tom Ogilvy



"Peter" wrote in message
...
Hi again Tom,

That was something i knew, but it is not what i meant.
I'm going to try to give you an example of what i want.

in a vba code:
A1 = G5 = E3 = K10 = F2
when A1 is selected and enter is hit move to cell G5
when E3 is selected and enter is hit move to cell K10
when................and so on

The starting cell is a single selected cell, the end cel is the next cell
that has been written in the code.

I don't want all the cells selected at the same time, i'm just looking
for

a
taborder to move from one cell to another.

Regards,
Peter


"Tom Ogilvy" schreef in bericht
...
Just to clarify.
Use the mouse and the control key to select the cells in the order you
want
to nagivate through them (so that all the cells of interest are

selected).
then leave them selected.

Now use the enter/return key to travel through them.

--
Regards,
Tom Ogilvy


"Peter" wrote in message
...
No, the activecell is specified.
It's like the textbox- taborder in a userform, you know what i mean?
"Tom Ogilvy" schreef in bericht
...
No matter where the activecell is, if the user hits enter, you want

to
go
to
G4?

--
Regards,
Tom Ogilvy

"Peter" wrote in message
...
Hi,

Is it possible that, when you hit the enter button, the cursor
moves
to
a
cell specified by me?
For instance:
A1 =="enter" ==G4
















All times are GMT +1. The time now is 05:55 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com