ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Control Cursor movement with Tab (https://www.excelbanter.com/excel-discussion-misc-queries/124069-control-cursor-movement-tab.html)

Costi

Control Cursor movement with Tab
 
I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you

Gord Dibben

Control Cursor movement with Tab
 
See Bob Phillips' site for info on using a named range.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

There is also sheet_change code that will leap around in any order you like.

If you want an example of that, post back.


Gord Dibben MS Excel MVP

On Fri, 29 Dec 2006 10:30:01 -0800, Costi
wrote:

I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you



Costi

Control Cursor movement with Tab
 
Thanks Gord, could you please provide the example of the Sheet_change code?
Costi

"Gord Dibben" wrote:

See Bob Phillips' site for info on using a named range.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

There is also sheet_change code that will leap around in any order you like.

If you want an example of that, post back.


Gord Dibben MS Excel MVP

On Fri, 29 Dec 2006 10:30:01 -0800, Costi
wrote:

I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you




Gord Dibben

Control Cursor movement with Tab
 
Surely can.

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

Just keep adding cases and ranges.


Gord

On Fri, 29 Dec 2006 14:26:01 -0800, Costi
wrote:

Thanks Gord, could you please provide the example of the Sheet_change code?
Costi

"Gord Dibben" wrote:

See Bob Phillips' site for info on using a named range.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

There is also sheet_change code that will leap around in any order you like.

If you want an example of that, post back.


Gord Dibben MS Excel MVP

On Fri, 29 Dec 2006 10:30:01 -0800, Costi
wrote:

I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you





Carl

Control Cursor movement with Tab
 
Gord,

I use Office XP (Excel XP), I tried both of the methods detailed in this
thread and neither one worked for me. I tried the "case select" with
protection on and I tried the "named range" with protection both on and off.
What am I doing wrong?

"Gord Dibben" wrote:

Surely can.

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

Just keep adding cases and ranges.


Gord

On Fri, 29 Dec 2006 14:26:01 -0800, Costi
wrote:

Thanks Gord, could you please provide the example of the Sheet_change code?
Costi

"Gord Dibben" wrote:

See Bob Phillips' site for info on using a named range.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

There is also sheet_change code that will leap around in any order you like.

If you want an example of that, post back.


Gord Dibben MS Excel MVP

On Fri, 29 Dec 2006 10:30:01 -0800, Costi
wrote:

I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you





Carl

Control Cursor movement with Tab
 
Gord, I don't know what changed but the "case select" method is working now.

"Gord Dibben" wrote:

Surely can.

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

Just keep adding cases and ranges.


Gord

On Fri, 29 Dec 2006 14:26:01 -0800, Costi
wrote:

Thanks Gord, could you please provide the example of the Sheet_change code?
Costi

"Gord Dibben" wrote:

See Bob Phillips' site for info on using a named range.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

There is also sheet_change code that will leap around in any order you like.

If you want an example of that, post back.


Gord Dibben MS Excel MVP

On Fri, 29 Dec 2006 10:30:01 -0800, Costi
wrote:

I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you





Gord Dibben

Control Cursor movement with Tab
 
Only the one method outlined at Bob's site uses sheet protection and unlocked
cells.

The named range method does need sheet protection.

The Case Select method which is now working for you does not use sheet
protection either.

Gord


On Tue, 20 Feb 2007 12:40:23 -0800, Carl wrote:

Gord, I don't know what changed but the "case select" method is working now.

"Gord Dibben" wrote:

Surely can.

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

Just keep adding cases and ranges.


Gord

On Fri, 29 Dec 2006 14:26:01 -0800, Costi
wrote:

Thanks Gord, could you please provide the example of the Sheet_change code?
Costi

"Gord Dibben" wrote:

See Bob Phillips' site for info on using a named range.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

There is also sheet_change code that will leap around in any order you like.

If you want an example of that, post back.


Gord Dibben MS Excel MVP

On Fri, 29 Dec 2006 10:30:01 -0800, Costi
wrote:

I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you






Carl

Control Cursor movement with Tab
 
Gord,

Thanks for the quick reply. Now that I know I'm not supposed to use
Worksheet Protection I was all jazzed about finally seeing this work. But...
nothing seems to be controlling the movement of the cursor. Here is my code:

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$E$5"
Range("E12").Select
Case "$E$12"
Range("E14").Select
Case "$E$14"
Range("E16").Select
Case "$E$16"
Range("E18").Select
Case "$E$18"
Range("E20").Select
Case "$E$20"
Range("E22").Select
Case "$E$22"
Range("O12").Select
Case "$O$12"
Range("O14").Select
Case "$O$14"
Range("O16").Select
Case "$O$16"
Range("O18").Select
Case "$O$18"
Range("V12").Select
Case "$V$12"
Range("V14").Select
Case "$V$14"
Range("V16").Select
Case "$V$16"
Range("V18").Select
Case "$V$18"
Range("R12").Select
Case "$R$12"
Range("R14").Select
Case "$R$14"
Range("R16").Select
Case "$R$16"
Range("R18").Select
Case "$R$18"
Range("X12").Select
Case "$X$12"
Range("X14").Select
Case "$X$14"
Range("X16").Select
Case "$X$16"
Range("X18").Select
Case "$X$18"
Range("E5").Select
End Select
End Sub

One thing I noticed was the Private Sub naming. By default my Visio Studio
provided "Worksheet_SelectionChange(ByVal Target As Range)", but your example
uses "Worksheet_Change". Have I introduced an error? And where can I read
about the function Target.Address?

Thanks again for your assistance.

"Gord Dibben" wrote:

Only the one method outlined at Bob's site uses sheet protection and unlocked
cells.

The named range method does need sheet protection.

The Case Select method which is now working for you does not use sheet
protection either.

Gord


On Tue, 20 Feb 2007 12:40:23 -0800, Carl wrote:

Gord, I don't know what changed but the "case select" method is working now.

"Gord Dibben" wrote:

Surely can.

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$C$2"
Range("C5").Select
Case "$C$5"
Range("E2").Select
Case "$E$2"
Range("E5").Select
End Select
End Sub

Just keep adding cases and ranges.


Gord

On Fri, 29 Dec 2006 14:26:01 -0800, Costi
wrote:

Thanks Gord, could you please provide the example of the Sheet_change code?
Costi

"Gord Dibben" wrote:

See Bob Phillips' site for info on using a named range.

http://www.xldynamic.com/source/xld.xlFAQ0008.html

There is also sheet_change code that will leap around in any order you like.

If you want an example of that, post back.


Gord Dibben MS Excel MVP

On Fri, 29 Dec 2006 10:30:01 -0800, Costi
wrote:

I have created a form with Excel. I need to know if I can plan the path of
the cursor so that when the user presses Tab, the cursor goes to a
predetermined cell (Or group of cells) rather than just move logically to the
next unprotected cell.

Thank you








All times are GMT +1. The time now is 08:31 PM.

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