I tested with this code..................
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
ActiveSheet.Unprotect Password:="justme"
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
End If
Set OldCell = Target
OldCell.Interior.ColorIndex = 6
OldCell.Borders.LineStyle = xlContinuous
Else
If OldCell Is Nothing Then
Set OldCell = Target
Else
Set OldCell = Union(OldCell, Target)
End If
End If
ActiveSheet.Protect Password:="justme"
End Sub
My testing with random cells in columns A, D, and G given a thick border,
protection set to "unlocked" and sheet protected with the password
"justme"(quotes required). You can safely change that password with no
effect on the code.
Hit Tab and next unlocked cell is selected, color to yellow and border
preserved.
Tab to next unlocked cell and color is yellow and border preserved.
Previous cell loses color and border has been preserved.
Do you want the tabbed to cells to reatin the color yellow?
I would not think so given your requirement to highlight current cell for
user.
Somehow you may have disabled events while booping about.
Sub enable_events()
Application.EnableEvents = True
End Sub
Gord