Changing the color of highlighted cells

K

krish

Is it possible to change the color of the cells when a range is selected with
the mouse pointer?

Not simply changing the color of a range of cells, but changing the
highlighted ones only? It seems like it should be a simple default option
change, gridline color can be changed, so I would think the highlighting
color would be able to also?
 
G

Gord Dibben

Only though VBA and with some possibly unwanted results.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static OldCell As Range
If Application.CutCopyMode = 0 Then
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
OldCell.Borders.LineStyle = xlLineStyleNone
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
End Sub

Will color the selected cell(s) yellow.

Note: will wipe out existing background color of cells cell unless BG
color is due to CF


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top