Color active cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can the active cell be made to automatically appear in color instead of
white. The purpose would be help your eye locate the cell when moving thru
the sheet.
 
contiditional formatting, if cell equals ? click format then change the
pattern to what ever color you want
 
You could download Chip Pearson's ROWLINER add-in as Dave suggests.

Or use event code

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static OldCell As Range
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
End If
Target.Interior.ColorIndex = 3
Set OldCell = Target
End Sub

Note: this is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that module.

If not what you're looking for, post back.


Gord Dibben MS Excel MVP

Can the active cell be made to automatically appear in color instead of
white. The purpose would be help your eye locate the cell when moving thru
the sheet.

Gord Dibben MS Excel MVP
 
Thank you Gord Dibben. It works perfectly!

Gord Dibben said:
You could download Chip Pearson's ROWLINER add-in as Dave suggests.

Or use event code

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Static OldCell As Range
If Not OldCell Is Nothing Then
OldCell.Interior.ColorIndex = xlColorIndexNone
End If
Target.Interior.ColorIndex = 3
Set OldCell = Target
End Sub

Note: this is sheet event code. Right-click on the sheet tab and "View Code".

Copy/paste into that module.

If not what you're looking for, post back.


Gord Dibben MS Excel MVP



Gord Dibben MS Excel MVP
 
Gord, this is great code;
the code however prevents me
from doing any copy/cut and
paste rountines;
How can I do both?
TIA,
 
Jim

This code was originally from Chip Pearson from this site.

http://www.cpearson.com/excel/excelM.htm#HighlightActiveCell

I don't know how to modify to allow copy/cut paste.

Suggest you use Chip's Rowliner add-in as he suggests at the site above.

A caveat with the Rowliner.

After the copy, be sure to right-click on the destination cell to paste.

Left-click and paste will paste a picture


Gord

Gord, this is great code;
the code however prevents me
from doing any copy/cut and
paste rountines;
How can I do both?
TIA,

Gord Dibben MS Excel MVP
 
Gord, Got it working (see below) - Also had to add Workbook.Open code
(also below)
Thanks Jim

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
=====================================================
Private Sub Workbook_Open() 'To erase Highlighted Cell when Last Saved
ActiveCell.Interior.ColorIndex = xlColorIndexNone
ActiveCell.Borders.LineStyle = xlLineStyleNone
End Sub
 
Well done Jim

I will keep this one..........attributed to yourself.

Thanks, Gord

Gord, Got it working (see below) - Also had to add Workbook.Open code
(also below)
Thanks Jim

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
=====================================================
Private Sub Workbook_Open() 'To erase Highlighted Cell when Last Saved
ActiveCell.Interior.ColorIndex = xlColorIndexNone
ActiveCell.Borders.LineStyle = xlLineStyleNone
End Sub

Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top