ask mentioned in the title, I am trying to highlight some rows using VBA. Well parts of my data get highlighted, but my last row and my first column "A" get highlighted.
''Carton Audit Format Control
'
Range("B16:V1000").FormatConditions.Delete
Range("$B16:$V100").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=AND($P16=0,$B176>0)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
Range("$B16:$V100").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$F17>$P17"
Selection.FormatConditions(Selection.FormatConditions.Count).Priority = 2
With Selection.FormatConditions(2).Interior
.PatternColorIndex = xlAutomatic
.Color = 65535
.TintAndShade = 0
End With
Selection.FormatConditions(2).StopIfTrue = False
Range("$B16:$V100").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$F17<$P17"
Selection.FormatConditions(Selection.FormatConditions.Count).Priority = 3
With Selection.FormatConditions(3).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0.599993896298105
End With
Selection.FormatConditions(3).StopIfTrue = False
End Sub
Anything helps. Thanks so much!