I have reposted my solution, which now contains two different solutions. Here is the code for the first solution that I posted earlier. This is the code associated with the button click:
The second solution adds a user-defined function that returns the formula in a cell. This is a more general solution that is easier for a user to manage. In this case, I added a function called CELLFORMULA that returns the formula in a cell:
Using this UDF, you can now construct a formula in conditional formatting to highlight the cell if it contains "-". For example, in cell B2 you would have the following rule to highlight the cell:
=NOT(ISERROR(FIND("-",CELLFORMULA(B2))))
Note: If the cell contains a "-" in any context, such as containing a negative number or a text string with a "-", this condition will be TRUE.
Bookmarks