tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone, this macro works great but as soon as i added
VBA Code:
Sub ConditionalFormatting()
Num = ActiveSheet.Range("AD108").Value + 108
Dim MyRange As Range
Dim MyRange2 As Range
Dim MyRange3 As Range
Dim MyRange4 As Range
Set MyRange = Range("AE111:AP" & Num)
Set MyRange2 = Range("AE111:AI" & Num)
Set MyRange3 = Range("AJ111:AJ" & Num)
Set MyRange4 = Range("AK111:AP" & Num)
MyRange.FormatConditions.Delete
MyRange.FormatConditions.Add Type:=xlExpression, Formula1:="=IF($AA111=""Title"",TRUE)"
MyRange.FormatConditions(1).Interior.Color = RGB(198, 224, 180)
MyRange.FormatConditions(1).Font.Color = RGB(68, 104, 86)
MyRange.FormatConditions(1).Font.Bold = True
'MyRange.FormatConditions(1).Borders.Color = RGB(68, 104, 86)
MyRange.FormatConditions(1).StopIfTrue = False
MyRange2.FormatConditions.Add Type:=xlExpression, Formula1:="=IF($AA111=""Rate"",TRUE)"
MyRange2.FormatConditions(2).Interior.Color = RGB(230, 240, 225)
MyRange2.FormatConditions(2).Font.Color = RGB(68, 104, 86)
MyRange2.FormatConditions(2).Borders.Color = RGB(68, 104, 86)
MyRange2.FormatConditions(2).StopIfTrue = False
'it worked great until i added these?
MyRange3.FormatConditions.Add Type:=xlExpression, Formula1:="=IF($AA111=""Rate"",TRUE)"
MyRange3.FormatConditions(3).Interior.Color = RGB(255, 255, 255)
MyRange3.FormatConditions(3).Font.Color = RGB(68, 104, 86)
MyRange3.FormatConditions(3).Borders.Color = RGB(68, 104, 86)
MyRange3.FormatConditions(3).StopIfTrue = False
MyRange4.FormatConditions.Add Type:=xlExpression, Formula1:="=IF($AA111=""Rate"",TRUE)"
MyRange4.FormatConditions(1).Interior.Color = RGB(230, 240, 225)
MyRange4.FormatConditions(1).Font.Color = RGB(68, 104, 86)
MyRange4.FormatConditions(1).Borders.Color = RGB(68, 104, 86)
MyRange4.FormatConditions(1).StopIfTrue = False
End Sub