[Solved] How to use VBA in Google Sheets to highlight cells with special characters and uppercase letters?


I don’t think you need scripts. You could use conditional formatting. It seems the only reason you’re using VBA is because you need REGEX, which Microsoft excel doesn’t support except through VBA. Google Sheets however has REGEX support inbuilt.

… highlights all Cells in Range C1 to E10000 which contain anything else than lowercase a–z, numbers and hyphens….

Conditional formatting >Custom formula:

=REGEXMATCH(C1,"^[a-z0-9\-]+$")

This will be used to match

  • Lowercase
  • Numbers
  • Hyphen (-)

Highlight yellow
Apply to range: C1:E10000

Note: Spaces are not matched. So, If you have spaces, It will not match.

5

solved How to use VBA in Google Sheets to highlight cells with special characters and uppercase letters?