DarrenBurke
New Member
- Joined
- May 6, 2022
- Messages
- 29
- Office Version
- 2016
- 2007
- Platform
- Windows
Hi Guys and Ladies
I have an Array for using the Tab Key. I would like the color (colour... for english UK) of the active cell to change as the user tabs through the sheet. Basically to see what cell he/she is currently on.
My code for the sheet. Tab key works perfect, a bit of bling would be nice Cheers and thank you for the help.
I have an Array for using the Tab Key. I would like the color (colour... for english UK) of the active cell to change as the user tabs through the sheet. Basically to see what cell he/she is currently on.
My code for the sheet. Tab key works perfect, a bit of bling would be nice Cheers and thank you for the help.
VBA Code:
Private Sub TabOrder()
'Set applicable sheet name
Const TabSheet = "PICKUP COPY1"
Dim Limit As Integer, NumPos As Integer
Dim NextPos As String, MyCel As String
Dim MyTO
'Set tab offset for other sheets
If ActiveSheet.Name <> TabSheet Then
ActiveCell.Offset(0, 1).Select
Exit Sub
End If
'Set your cells in desired order
MyTO = Array("C7", "C6", "E4", "C8", "C10", "C12", "C14", "C16", "C18", "C20", "C22", "C24", "D24", "E24", "C26", "C32", "F34", "A36", "I7", "I6", "K4", "I8", "I10", "I12", "I14", "I16", "I18", "I20", "I22", "I24", "J24", "K24", "I26", "I32", "L34", "G36", "O7", "O6", "Q4", "O8", "O10", "O12", "O14", "O16", "O18", "O20", "O22", "O24", "P24", "Q24", "O26", "O32", "R34", "M36", "S46")
Limit = UBound(MyTO)
MyCel = ActiveCell.Address(0, 0)
'Check for match in array
On Error GoTo LastLine
NumPos = Application.WorksheetFunction.Match(MyCel, MyTO, 0)
'Return to first cell
If NumPos = Limit Then
NextPos = MyTO(1)
Else
NextPos = MyTO(NumPos + 1)
End If
Range(NextPos).Activate
Exit Sub
LastLine:
'Set tab offset if named cell not found
ActiveCell.Offset(0, 1).Select
End Sub