ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Tabing through cells on a protected worksheet (https://www.excelbanter.com/excel-discussion-misc-queries/164140-tabing-through-cells-protected-worksheet.html)

bnhcomputing

Tabing through cells on a protected worksheet
 
I haven't been able to find answer, so here goes.

I have a protected sheet with three (3) unlocked cells. As I tab /
Shft-Tab I can move between the three cells.

Question: How do I get the Tab to stop when it gets to the last
unlocked cell? How do I get Shft-tab to stop when it gets to the
first unlocked cell?

When in the last cell, F12 for example, pressing tab takes me back to
B3. How do I get tab to stop once I get to F12, and Shft-tab to stop
once I am at B3?

I have asked the same question worded several different ways to try
and clarify what I am trying to accomplish. Any Ideas?

Thanks in advance,

bnhcomputing


Earl Kiosterud

Tabing through cells on a protected worksheet
 
I don't think you can keep the Tab key from wrapping the cells. If this is an important
issue, you could trap the Tab key with an OnKey in a macro, and do the selection in code.
If there are other sheets involved this will not be trivial, as the trapping wil be in
effects for all sheets in all open workbooks.

A barebones implementation is the following. It's to tab through A1, C1, E1.

Sub Setup() ' run this once
Application.OnKey "{Tab}", "Tabkey"
End Sub

Sub Tabkey()
Select Case (ActiveCell.Address)
Case Is = "$A$1"
Range("C1").Select
Case Is = "$C$1"
Range("E1").Select
Case Is = "$E$1" ' End of line. Do nothing
Case Else
Range("a1").Select ' start at A1
End Select
End Sub

If A1 is active, C1 will be selected. If C1, then E1. Any other cell -- A1. Another
routine would be needed for Shift-Tab. There are other ways to code it, depending on how
many cells are involved, and if there's a pattern.
--
Regards from Virginia Beach,

Earl Kiosterud
www.smokeylake.com

Note: Top-posting has been the norm here.
Some folks prefer bottom-posting.
But if you bottom-post to a reply that's
already top-posted, the thread gets messy.
When in Rome...
-----------------------------------------------------------------------
"bnhcomputing" wrote in message
oups.com...
I haven't been able to find answer, so here goes.

I have a protected sheet with three (3) unlocked cells. As I tab /
Shft-Tab I can move between the three cells.

Question: How do I get the Tab to stop when it gets to the last
unlocked cell? How do I get Shft-tab to stop when it gets to the
first unlocked cell?

When in the last cell, F12 for example, pressing tab takes me back to
B3. How do I get tab to stop once I get to F12, and Shft-tab to stop
once I am at B3?

I have asked the same question worded several different ways to try
and clarify what I am trying to accomplish. Any Ideas?

Thanks in advance,

bnhcomputing





All times are GMT +1. The time now is 09:22 AM.

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