Solved

Highlighting the Active Cell in Excel

Posted on 2014-07-21
12
324 Views
Last Modified: 2014-07-21
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.
0
Comment
Question by:Bright01
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
  • 2
  • +1
12 Comments
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40208944
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

0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40208957
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
0
 

Author Comment

by:Bright01
ID: 40208964
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.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Bright01
ID: 40208993
Duncan,

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

B.
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 40209003
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
0
 
LVL 10

Expert Comment

by:Anthony Berenguel
ID: 40209017
Is there a reason you can't use conditional formatting?
0
 

Author Comment

by:Bright01
ID: 40209026
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.
0
 

Author Comment

by:Bright01
ID: 40209039
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.
0
 
LVL 27

Expert Comment

by:MacroShadow
ID: 40209059
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

0
 

Author Comment

by:Bright01
ID: 40209085
I get a debug error on line:  rngPrevious.Interior.colorindex=lngcolor
0
 
LVL 27

Accepted Solution

by:
MacroShadow earned 500 total points
ID: 40209120
That will only happen the first time, since the previous range wasn't set yet.

You can either precede that line with on error resume next or better yet check if rngPrevious isn't nothing.

Option Explicit

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
    If Not rngPrevious Is Nothing Then 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

0
 

Author Closing Comment

by:Bright01
ID: 40209501
Works great!  Much thanks.........


B.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel Macro update each line based on another worksheet 2 46
have to show the rows i need 9 36
Embed Excel WS into PPTX 4 20
Vlookup Help 3 22
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
This Micro Tutorial will demonstrate on a Mac how to change the sort order for chart legend values and decrpyt the intimidating chart menu.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question