View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default How to discovery the color...

for the Font:
Dim r as Range
set r = range(€œA1€)

If r.Font.ColorIndex = 3 then
Msgbox €œred€
End if

if the cell background is red:

Dim r as Range
set r = range(€œA1€)

If r.Interior.ColorIndex = 3 then
Msgbox €œred€
End if

--
regards,
Tom Ogilvy

"Lisandro Oliveira" wrote:

How can I know what is the color of the value of variable?
Example:

Cell A1 = €œtest€ (its in red)

VBA:

Dim var as string
Var = range(€œA1€).value

If var.Interior.ColorIndex = red then
Msgbox €œred€
End if

Tks,
Lisandro