View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Myrna Larson Myrna Larson is offline
external usenet poster
 
Posts: 863
Default To know cell color

The following code, when placed in the worksheet event-module, will enter OK,
AFTER you color the cell AND move to a new cell. Simply changing the color
without moving the cell cursor won't work, because changes in the interior
color doesn't trigger an event.

Private CellAddress

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rng As Range

If CellAddress < "" Then
Set Rng = Range(CellAddress)
If Rng.Interior.ColorIndex < xlColorIndexNone Then
Rng.Offset(0, 1).Value = "OK"
End If
End If

CellAddress = ActiveCell.Address

End Sub



On Fri, 18 Feb 2005 08:43:14 -0800, "Ayda"
wrote:


The cell is coloured manually. What I would like to do is that at the
moment the cell is coloured then the next side cell change to "OK".

Thanks

"Jim Thomlinson" wrote:

A couple of quick questions...

1. How did the cell get to be yellow in the first place? Conditional Format
or Manually selected. If contional format then we can use the logic that
turned it yellow to make the coresponding cell value "Ok"

2. If the colour was selected manually then we need to write code taht
recognizes the colour of cells which is relatively easy code. Did you wnat
the prograam to:
A. at the push of a button run through a spreadsheet that has already

been
coloured.
B. define the corresponding cell at the time when a cell is coloured.

3. Define Yellow. There are lots of shades of yellow...

"Ayda" wrote:

Hello,

It's possible by formula to know the color of cell ?

I tried with the formula CELL ("color",cell_reference) but this one just
tell me if the the cell has been formatted with color for negative

numbers.

I want to know if the cell has been filled with a specific color and in

that
case assign a value to another cell, something like:

if cellXY_color = "yellow" then
cellZV = "OK"

Thanks