I have input cells on a protected sheet with a tab order array setup. It was originally set up to work when their was a Worksheet Change. Not every cell is going to have data input into it. This is where the problem lies. If a cell is left blank it tabs out of sequence. I changed it to a Worksheet Open Sub but that didn't work.
Code is as follows:
Code
Private Sub Worksheet_Open(ByVal Target As Range)
Dim aTabOrd As Variant
Dim i As Long
'Set the tab order of input cells
aTabOrd = Array("D1", "U1", "AG1", "E3", "E6", "E7", "E8", "E9", "C10", "Q10", _
"D11", "Q11", "D12", "Y6", "Y7", "Y8", "Y9", "W10", "AK10", "X11", "AK11", "X12", _
"E13", "Q13", "Z13", "AG13", "D14", "Q14", "AG14", "F15", "O15", "AA15", "AI15", _
"E16", "M16", "S16", "AA16", "AI16", "C17", "G17", "N17", "D18", "E19", "C20", "E21", _
"G22", "P22", "F23", "A24", "A25", "A26", "A27", "A28", "A29", "AD19", "S20", "U20", "AD20", _
"S21", "U21", "AD21", "S22", "U22", "AD22", "S23", "U23", "AD23", "S24", "U24", "AD24", "S25", _
"U25", "AD25", "S27", "U27", "AD27", "S28", "U28", "AD28", "S29", "U29", "AD29", "AI32", _
"AF35", "C31", "L31", "C32", "N32", "F34", "D35", "G36", "G37", "D38", "F50", "T40", "AI40", _
"AI42", "AI43", "AI44", "AI45", "AI47", "AI48", "AI49", "AI50")
'Loop through the array of cell address
For i = LBound(aTabOrd) To UBound(aTabOrd)
'If the cell that's changed is in the array
If aTabOrd(i) = Target.Address(0, 0) Then
'If the cell that's changed is the last in the array
If i = UBound(aTabOrd) Then
'Select first cell in the array
Me.Range(aTabOrd(LBound(aTabOrd))).Select
Else
'Select next cell in the array
Me.Range(aTabOrd(i + 1)).Select
End If
End If
Next i
End Sub
Display More
What needs to change in order to stay in sequence, even if a cell within the array is left unchanged?
Thanks.