Sub Colour_Coding()
'
' Colour_Coding Macro
' Colour Coding for Security Review Cases
'
Dim rng As Range
Set rng = Range("H:K")
rng.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""X"""
rng.FormatConditions(rng.FormatConditions.Count).SetFirstPriority
With rng.FormatConditions(1).Font
.Color = -16752384
.TintAndShade = 0
End With
With rng.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13561798
.TintAndShade = 0
End With
rng.FormatConditions(1).StopIfTrue = False
Set rng = ActiveSheet.Range
rng.FormatConditions.Add Type:=xlTextString, String:="Has Access", TextOperator:=xlContains
rng.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With rng.FormatConditions(1).Font
.Color = -16752384
.TintAndShade = 0
End With
With rng.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13561798
.TintAndShade = 0
End With
rng.FormatConditions(1).StopIfTrue = False
rng.FormatConditions.Add Type:=xlTextString, String:="Yes", TextOperator:=xlContains
rng.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With rng.FormatConditions(1).Font
.Color = -16752384
.TintAndShade = 0
End With
With rng.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 13561798
.TintAndShade = 0
End With
End Sub
.Color = RGB(0, 255, 0)
Dim rng As Range
Dim fmtcon1 As FormatCondition
Set rng = ActiveSheet.UsedRange
Set fmtcon1 = rng.FormatConditions.Add(Type:=xlCellValue, Operator:=xlEqual, Formula1:="=""X""")
With fmtcon1
.SetFirstPriority
With .Font
.Color = RGB(0, 255, 0)
.TintAndShade = 0
End With
With .Interior
.PatternColorIndex = xlAutomatic
.Color = 13561798
.TintAndShade = 0
End With
.StopIfTrue = False
End With
Because ToArgb returns an integer. The highest byte of this integer is the alpha (transparency) channel. In many cases, the alpha value will make the integers sign bit be negative.so the negative is probably correct.
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
13 Experts available now in Live!