Conditional Formatting

  • Thread starter Thread starter wardides
  • Start date Start date
W

wardides

I have columns in excel that get formatted based on conditiona
formatting.

e.g. if cell G1 contains "1" then cell g2 is changed from bein
automatic colour to being Blue text on grey background.

The Blue text is colorindex 5.

However if the conditional formatting is applied and I select the cel
in the VB code the activecell.font.colorindex still returns the defaul
colour rather than the current formatted colour.

I need to check if the cell is a different font and if so skip it so i
there any way to get the font with the conditional formatting ?

Regards
Bria
 
Brain

You need to use the FormatCondition object. Hopefully the code below will
help, it looks for the Interior property of the first FormatCondition(1)
object in the range A1 and prints it to the immediate window.

Sub Getconditionalformatprops()
Dim fmtCondition As FormatCondition
Dim IntColor As Integer
Set fmtCondition = Range("A1").FormatConditions(1)
IntColor = fmtCondition.Interior.ColorIndex
Debug.Print IntColor
End Sub

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
(e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top