Cell formatting and if statement

C

Cortez

Is there a way to trigger an if statement based on the formatting of a
cell as opposed to the value in the cell?

I have a worksheet that displays channel frequencies in a grid
corresponding to various cities. All locations have each frequency,
but in some cities a given frequency can be in stereo or mono. In the
grid, a location with a frequency in stereo is denoted by a different
colour of text.

I would like to run an if statement from a macro that goes something
like:

if(textcolor(A1)=blue, true, false)

I assume that this isn't possible, but I am not confident enough to
give up on it.

Any help would be appreciated,
Thanks,
TK
 
M

mray29

Have yoiu considered conditional formatting? This automatically formats the
cell based on its contents. Look under Format/Conditional Formatting.
 
C

Cortez

I am not trying to change the formatting of the cells. I have
multiple cells with the same values, but the existing formatting
differs from cell to cell which denotes a significant variation.

I will reword my example in case it wasn't clear.

here is a sample of what I am looking for, but I don't know if there
is a means of doing it in a macro, or what the syntax would be:

For this example cell A1 contains the value 15 and is in blue text.

if cells(1, 1).TEXTCOLOR = BLUE then cells(1,2).value = "Stereo"

In other words, If the text in cell A1 is blue, then change the text
in B1 to say "stereo".

TK
 
C

Cortez

I have figured this out on my own, so I thought I would share it here:

If Cells(1, 1).Font.ColorIndex = 5 Then Sheet5.Cells(1, 2).Value =
"stereo"

colorindex 5 is the blue I need, other colors have different
corresponding colorindex values.

This does what I needed, hope someone else finds it helpful.

Thanks,
TK
 
Top