Livin404
Well-known Member
- Joined
- Jan 7, 2019
- Messages
- 743
- Office Version
- 365
- 2019
- Platform
- Windows
Is it possible to add cells to the right of a text string to be included in a Conditional Format? I used the VBA below and it's great, but I like to extend it out, so cells will have the same fill color, and those borders to the right and top removed. Only cells to the right of the top row containing the "DATE: " Thank you.
VBA Code:
Sub DATE_BACKGROUND()
Selection.FormatConditions.Add Type:=xlTextString, String:="DATE:", _
TextOperator:=xlContains
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
Selection.FormatConditions(1).Borders(xlRight).LineStyle = xlNone
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 10027008
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub