View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
[email protected] sbitaxi@gmail.com is offline
external usenet poster
 
Posts: 158
Default how do I change color of "active" cell to differentiate from rest

That's a cool like formula, I tried it on a worksheet that I am toying
with, but when I selected a cell that had existing formatting, it
cleared it back to white when I clicked away. Is it possible to return
it to the original colour? I've made a brief stab at it, but I'm still
pretty green with code.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
' Dim i As Target.Interior.ColorIndex
If Target.Interior.ColorIndex 0 Then
Let i = Target.Interior.ColorIndex
Target.Interior.ColorIndex = 6
Cells.Interior.ColorIndex = i
Else
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 6
End If
End Sub


Steven

On Apr 29, 2:54*pm, Gary''s Student
wrote:
Try this tiny worksheet event macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Cells.Interior.ColorIndex = xlNone
Target.Interior.ColorIndex = 6
End Sub

Because it is worksheet code, it is very easy to install and use:

1. right-click the tab name near the bottom of the window
2. select View Code - this brings up a VBE window
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE windows as above
2. clear the code out
3. close the VBE window

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm

To learn more about Event Macros (worksheet code), see:

http://www.mvps.org/dmcritchie/excel/event.htm

--
Gary''s Student - gsnu200782



"devildog97" wrote:
I want the cell I am working in to be highlighted in a color other then
white. How to I format it as so. Example.... wherever I click on the
worksheet, I want that single cell to be highligted to uniform color.- Hide quoted text -


- Show quoted text -