colorful cells

H

hakan

I have seen a file, active cell becomes colorful and
everytime cursor moves to another cell new cell becomes
colorful. I could not figure it out from conditional
formation please help.
Thanking in advance
 
D

Don Guillett

right click sheet tab>view code>insert this

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo endit
Cells.Interior.ColorIndex = 0
ActiveCell.Interior.ColorIndex = 6
endit:
Application.EnableEvents = True
End Sub
 
B

Bob Phillips

Here is a slight alternative that doesn't wipe out any other coloured cells

Dim oldCell As Range
Dim oldCol As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo endit
If Not oldCell Is Nothing Then
oldCell.Interior.ColorIndex = oldCol
End If
Set oldCell = Target
With Target
oldCol = .Interior.ColorIndex
.Interior.ColorIndex = 6
End With
endit:
Application.EnableEvents = True
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
A

Alan

Good one Bob,
I can use that too,
Thanks,
Alan.
Bob Phillips said:
Here is a slight alternative that doesn't wipe out any other coloured cells

Dim oldCell As Range
Dim oldCol As Long

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.EnableEvents = False
On Error GoTo endit
If Not oldCell Is Nothing Then
oldCell.Interior.ColorIndex = oldCol
End If
Set oldCell = Target
With Target
oldCol = .Interior.ColorIndex
.Interior.ColorIndex = 6
End With
endit:
Application.EnableEvents = True
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
D

David McRitchie

Hi Alan,
As much as I like Event macros, there is price with
all macros in that they wipe out the undo stack so
you cannot use Ctrl+Z to undo anything earlier.
An Event macro keeps you from using undo
at on that worksheet.

Unfortunately there is not accessibility feature
that I know of that addresses making the active
cell more visible, if really needed.

Since undo is such an important feature in
many application software I'd try to make sure
that the feature is worth more to me than the
ability to undo something.

When you select a cell the column letter and the
row letter are changed in color and I think Excel
2000 improves the distinction of selected areas
compared to previous versions.

Another event macro that is rather popular here
for that purpose is Chip Pearson's Rowliner
http://www.cpearson.com/excel/rowliner.htm

If you know you need a macro the excel.programming
group is the better group then we assume you know
about such things as installation and loss of undo stack.

The newsgroup He
 
A

Alan

Thanks David,
Food for thought indeed,
Regards,
Alan.
David McRitchie said:
Hi Alan,
As much as I like Event macros, there is price with
all macros in that they wipe out the undo stack so
you cannot use Ctrl+Z to undo anything earlier.
An Event macro keeps you from using undo
at on that worksheet.

Unfortunately there is not accessibility feature
that I know of that addresses making the active
cell more visible, if really needed.

Since undo is such an important feature in
many application software I'd try to make sure
that the feature is worth more to me than the
ability to undo something.

When you select a cell the column letter and the
row letter are changed in color and I think Excel
2000 improves the distinction of selected areas
compared to previous versions.

Another event macro that is rather popular here
for that purpose is Chip Pearson's Rowliner
http://www.cpearson.com/excel/rowliner.htm

If you know you need a macro the excel.programming
group is the better group then we assume you know
about such things as installation and loss of undo stack.

The newsgroup He
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

Alan said:
Good one Bob [Phillips],
I can use that too,
 
Top