Excel Coloured Cursor

The following code could be placed in either the Selection_Change procedure of a worksheet, or the SheetSelectionChange procedure of a workbook.

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)

        Cells.Interior.ColorIndex = xlColorIndexNone<br>
        Selection.Interior.ColorIndex = 8

    End Sub

This code works for sheets with no fills in the background, as everytime the selection changes it makes all the cell interior colours equal to no fill.  Different background colours could be substituted in instead of xlColorIndexNone if necessary.   The colour of the cursor can also be changed (8 is cyan).  See VBA help for color indexes.

You might also like...




Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The trouble with programmers is that you can never tell what a programmer is doing until it's too late.” - Seymour Cray