Link to home
Start Free TrialLog in
Avatar of Bright01
Bright01Flag for United States of America

asked on

Highlighting the Active Cell in Excel

EE Pros,

How do I change the condition for the active cell within Excel, to be highlighted?  Right now it's simply a bold box that shows up on the active cell.  Is there a way to either increase the boldness of the box on the active cell or give it some color?  It would make it easier to see in a large Worksheet.

Thank you,

B.
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Try this macro, put it in the worksheet module:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.ScreenUpdating = False
    Cells.Interior.ColorIndex = 0          ' Clear the color of all the cells
    Target.Interior.ColorIndex = 8       ' Highlight the active cell
    Application.ScreenUpdating = True
End Sub

Open in new window

Avatar of duncanb7
duncanb7

Do you need to do it on Excel Cell only  , please take a look the  MS manual for highlight and add/remove broder of the cell at this sites ?
http://office.microsoft.com/en-gb/excel-help/highlight-cells-HP001216435.aspx 
http://office.microsoft.com/en-001/excel-help/apply-or-remove-cell-borders-on-a-worksheet-HP001216433.aspx

Duuncan
Avatar of Bright01

ASKER

MicroShadow,

Almost works; but the ColorIndex = 0 changed all of my other colors in the WS.  I only need the highlighting on the cell I'm covering, then it needs to return to its original color.

Thank you,

B.
Duncan,

I'm using 2010....tried to use the Cell Styles but it didn't work.

B.
take a look at this for Excel Cell for cell style from MS manual
http://office.microsoft.com/en-001/excel-help/apply-create-or-remove-a-cell-style-HP001216732.aspx

Please let us know if want it on  VBA

Duncan
Is there a reason you can't use conditional formatting?
I'm already using Conditional formatting for the content that is going into the cells.  I'm trying to highlight the cursor as I hover over the cells... so I can see them better.

B.
Duncan,

It's not that I want to change the cell style for a group of cells; it's that I want to highlight the cell I'm hovering over so I can see it better.......

B.
Try this:
Public rngPrevious As Range
Public lngColor As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Application.ScreenUpdating = False
    ' re-apply Interior.ColorIndex to previous cell
    rngPrevious.Interior.ColorIndex = lngColor
    ' Save original Interior.ColorIndex of curent cell
    lngColor = Target.Interior.ColorIndex
    Set rngPrevious = Target
    ' Highlight the active cell
    Target.Interior.ColorIndex = 8
    Application.ScreenUpdating = True
End Sub

Open in new window

I get a debug error on line:  rngPrevious.Interior.colorindex=lngcolor
ASKER CERTIFIED SOLUTION
Avatar of Joe Howard
Joe Howard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Works great!  Much thanks.........


B.