ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Changing the color of highlighted cells (https://www.excelbanter.com/excel-discussion-misc-queries/222808-changing-color-highlighted-cells.html)

Krish

Changing the color of highlighted cells
 
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?

Gord Dibben

Changing the color of highlighted cells
 
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



On Mon, 2 Mar 2009 13:05:01 -0800, krish
wrote:

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?




All times are GMT +1. The time now is 12:57 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com