Dabaron2321
New Member
- Joined
- Jan 20, 2016
- Messages
- 9
Hi, I have a macro that conditional formats a cell depending on the country it contains. What I need though is a way so that a particular colour scheme can apply to more than one country. So basically if A1 = "Sweden" "TRUE "FALSE" can become if A1= "Sweden" or "Ukraine" or "Barbados" "TRUE "FALSE" for example.
Here is the code:
<code> </code><code>
Any help appreciated!</code>
Here is the code:
<code> </code><code>
Code:
Range("A1:ah60").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF(A1=""Bosnia & Herzegovina"",TRUE,FALSE)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = RGB(0, 0, 0)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
.Pattern = xlPatternLinearGradient
.Gradient.Degree = 15
.Gradient.ColorStops.Clear
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(0)
.Color = RGB(0, 0, 225)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(0.07)
.Color = RGB(0, 0, 225)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(0.1)
.Color = RGB(255, 255, 0)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(0.13)
.Color = RGB(255, 255, 0)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(0.16)
.Color = RGB(0, 0, 225)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(0.19)
.Color = RGB(0, 0, 225)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(0.22)
.Color = RGB(245, 255, 255)
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior.Gradient.ColorStops.Add(1)
.Color = RGB(245, 255, 255)
.TintAndShade = 0
End With
End Sub
</code><code>
Any help appreciated!</code>