tonywatsonhelp
Well-known Member
- Joined
- Feb 24, 2014
- Messages
- 3,210
- Office Version
- 365
- 2019
- 2016
- Platform
- Windows
Hi Everyone,
I have recorded this vba with the macro recorder but it seams a little long, does anyone know how i could cut it down,
I want to use it as the template for all my conditional formatting vba that I'm going to need so having something easy to edit and that is written more compactly would be a huge help,
thanks
Tony
here's my code
I have recorded this vba with the macro recorder but it seams a little long, does anyone know how i could cut it down,
I want to use it as the template for all my conditional formatting vba that I'm going to need so having something easy to edit and that is written more compactly would be a huge help,
thanks
Tony
here's my code
VBA Code:
Sub LegalCF_for_Row38()
Range("E38:H38").Select
Selection.FormatConditions.Delete
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=IF($E$38=""Select Hospital Records"",TRUE)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Font
.Color = -16776961
.TintAndShade = 0
End With
With Selection.FormatConditions(1).Borders(xlLeft)
.LineStyle = xlContinuous
.Color = -16776961
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlRight)
.LineStyle = xlContinuous
.Color = -16776961
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlTop)
.LineStyle = xlContinuous
.Color = -16776961
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Borders(xlBottom)
.LineStyle = xlContinuous
.Color = -16776961
.TintAndShade = 0
.Weight = xlThin
End With
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.799981688894314
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub