Posted By

aianrnoens on 03/04/11


highlight excel color change vba

Versions (?)

Change Highlight Color Excel 2007

 / Published in: Visual Basic


Use this code to change the default highlight color for a cell in excel 2007. Right click on the sheet name and click view code, Paste this code into the module that comes up.

  1. Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
  2. Static OldCell As Range
  3. If Not OldCell Is Nothing Then
  4. OldCell.Interior.ColorIndex = xlColorIndexNone
  5. End If
  6. Target.Interior.ColorIndex = 6 'yellow
  7. Set OldCell = Target
  8. End Sub

Report this snippet  

You need to login to post a comment.