MARK858
MrExcel MVP
- Joined
- Nov 12, 2010
- Messages
- 16,820
- Office Version
- 365
- Platform
- Windows
- Mobile
Hi there, I have a very basic conditional format code that I recorded which works fine as far as it goes, but what I would like to do is apply it down to the last used row rather than a range i.e. last used row rather than row 8185 .
Does anyone know the correct syntax for achieving this as I have never attempted conditional formatting with a macro (and probably still wouldn't if the workbook was just for my use)?
Thanks in advance for any suggestions anyone might have.
Current code below
Does anyone know the correct syntax for achieving this as I have never attempted conditional formatting with a macro (and probably still wouldn't if the workbook was just for my use)?
Thanks in advance for any suggestions anyone might have.
Current code below
Code:
Range("A2:S8185").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$S2<$T2"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = True
End Sub