View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jake Marx[_3_] Jake Marx[_3_] is offline
external usenet poster
 
Posts: 860
Default Selection highlight color

Hi Abhilash,

news.microsoft.com wrote:
When cells are selected a blue color transparent color appears in the
selection. Is it possible to change the color programatically?


You could do this by placing code similar to the following in the
ThisWorkbook module:

Private rngOld As Range

Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, _
ByVal Target As Range)
If Not rngOld Is Nothing Then rngOld.Interior.ColorIndex = 0
Set rngOld = Selection
rngOld.Interior.Color = RGB(255, 0, 0)
ActiveCell.Interior.ColorIndex = 0
End Sub

As written, this will "overwrite" any fill colors your cells had prior to
being selected. You could use a static array to track the colors, then set
them back to the originals instead of setting colorindex=0 if you want.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]