Home |
Search |
Today's Posts |
#1
|
|||
|
|||
Tab Order
Can anyone tell me what is wrong with this code? I believe it has something to do with the array. I had a similar sheet (with the same type of code) working, but when I changed the array it stopped working.
Public i As Integer Private Sub Worksheet_selectionChange(ByVal Target As Range) 'Erik Van Geit '050510 0044 'force user to tab in specific order = TabOrder 'selections within Taborder will be allowed else selection will jump to next 'problem when pressing "ENTER" an "allowed" cell is activated 'example (A1, C1, A2) change A1 == A2 is activated instead of C1 Dim TabOrder As Variant Application.EnableEvents = False TabOrder = Array("j1", "j2", "e4", "d5", "b11", "b12", "b13", "b14", "b15", "b16", "b17", "b18", "b19", "b20", "b21", "b22", "b23", "c23", "b27", "b28", "b29", "b30", "b31", "f34", "f36", "f38", "d39", "d40", "d41", "e43", "e44", "d46", "d47", "d50", "d51", "b55", "b56", "b57", "i9", "g12", "g13", "g14", "g15", "i18", "g21", "k26", "k28", "h36", "i36", "h37", "i37", "h38", "i38", "h45", "i45", "k45", "h46", "i46", "k46", "h47", "i47", "k47", "k56", "k58", "l58", "k60", "l60") On Error Resume Next ref = Application.Match(Target.Address(0, 0), TabOrder, 0) On Error GoTo 0 If IsError(ref) Then If i = UBound(TabOrder) Then i = 0 Else i = i + 1 Me.Range(TabOrder(i)).Select Else i = ref - 1 If ref < 0 Then ref = UBound(TabOrder) End If Application.EnableEvents = True End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Why is the order of my data table opposite from graph? | Charts and Charting in Excel | |||
How to change Series order in a Combination Chart? | Charts and Charting in Excel | |||
How to change Series Order in a Combination Chart? | Excel Discussion (Misc queries) | |||
purchase order counter in excel purchase order template | Excel Worksheet Functions | |||
Maintaining a default worksheet order | Excel Discussion (Misc queries) |