MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Active Cell Selector

Posted by Catrina on November 13, 2000 7:36 AM

Is there a way to change the color of the active cell selector outline? I created a form and want the activecell to be highlighted as you move through the form.

Posted by Tim Francis-Wright on November 16, 2000 2:58 PM

The logic behind this comes from
Chip Pearson's site (

What this lacks is a test to see if a
particular form is loaded or not--you
might want this behavior to start when
the form becomes visible and to stop
when it's hidden. (I couldn't get it to
work that way.)

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target As Excel.Range)

Static OldRange As Range
Static OldColor As Integer
Static NewColor As Integer
On Error Resume Next
NewColor = Target.Interior.ColorIndex
Target.Interior.ColorIndex = 6 ' yellow - change as needed
OldRange.Interior.ColorIndex = OldColor
Set OldRange = Target
OldColor = NewColor
End Sub