I have a small VBA code to create Conditional Formatting in Excel, It works well on Excel 365, but it generates "Run-time error 5" when trying in earlier versions of excel (eg. 2016). Could you please advise a fix to make it works on most versions ?
Public Sub CF()
With Range("K20:ZH20").FormatConditions.Add(Type:=xlExpression, Formula1:="=ISNUMBER(SEARCH(" & Chr(34) & "Project Exec" & Chr(34) & ";$A$20))")
.Interior.Pattern = xlPatternLightUp
End With
End Sub
Thanks!
After John Coleman comment, I found that it was about regional setting. It raise error because I tested on computer with difference setting. (the code showing above works for computer with "." as thousand separator and not work for computer use "," as thousand separator. So the question now is how to make the code independent to regional settings ?