ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing tab order of locked worksheet cells (https://www.excelbanter.com/excel-programming/420502-changing-tab-order-locked-worksheet-cells.html)

PO

Changing tab order of locked worksheet cells
 
Hi,

Is there any way to change the tab order when tabbing between locked cells
in a protected worksheet - through script or otherwise?

Regards
Pete



John Bundy

Changing tab order of locked worksheet cells
 
You can do it through code, though it won't be easy. Put this in the sheet
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call test
End Sub

and this in a module
Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Integer

Const VK_CONTROL As Integer = &H11 'Ctrl


Sub test()
If GetKeyState(vbKeyTab) < 0 Then Ctrl = True Else Ctrl = False
If Ctrl = True Then
Cells(1, 1).Select

End If
End Sub

this selects just one cell, you can integrate a counter or another method to
decide where to move to.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"PO" wrote:

Hi,

Is there any way to change the tab order when tabbing between locked cells
in a protected worksheet - through script or otherwise?

Regards
Pete




PO

Changing tab order of locked worksheet cells
 
Thanks John! This was exactly what I was looking for.

Regards
Pete


"John Bundy" (remove) skrev i meddelandet
...
You can do it through code, though it won't be easy. Put this in the sheet
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Call test
End Sub

and this in a module
Declare Function GetKeyState Lib "user32" _
(ByVal nVirtKey As Long) As Integer

Const VK_CONTROL As Integer = &H11 'Ctrl


Sub test()
If GetKeyState(vbKeyTab) < 0 Then Ctrl = True Else Ctrl = False
If Ctrl = True Then
Cells(1, 1).Select

End If
End Sub

this selects just one cell, you can integrate a counter or another method
to
decide where to move to.
--
-John
Please rate when your question is answered to help us and others know what
is helpful.


"PO" wrote:

Hi,

Is there any way to change the tab order when tabbing between locked
cells
in a protected worksheet - through script or otherwise?

Regards
Pete







All times are GMT +1. The time now is 10:55 AM.

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