ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Conditional Formatting Based on Cell Content (https://www.excelbanter.com/excel-worksheet-functions/184896-conditional-formatting-based-cell-content.html)

lee

Conditional Formatting Based on Cell Content
 
How do I create conditional formatting based on cell content rather than cell
value? I'm trying to highlight cells with different colors for cells that
contain constants vs. formulas.

AKphidelt

Conditional Formatting Based on Cell Content
 
Not sure if this helps because it doesn't do it in an ongoing basis, but if
you highlight all the cells and go to

Edit--GoTo (Or just press Ctrl + G)
Then click on Special
Then click the box that says formulas and then ok

Now all the cells with formulas in them are hilighted and you can change all
the cells properties from there.

As far as conditional formatting goes, im not sure

"Lee" wrote:

How do I create conditional formatting based on cell content rather than cell
value? I'm trying to highlight cells with different colors for cells that
contain constants vs. formulas.


lee

Conditional Formatting Based on Cell Content
 
I'm trying to set up a spreadsheet for another user so that it automatically
highlights the cell for them when a formula is overwritten with a constant,
so I was really trying to avoid having the user manually change the format.
Is it possible to incorporate your suggestion into a macro in combination
with the conditional formatting feature?

"akphidelt" wrote:

Not sure if this helps because it doesn't do it in an ongoing basis, but if
you highlight all the cells and go to

Edit--GoTo (Or just press Ctrl + G)
Then click on Special
Then click the box that says formulas and then ok

Now all the cells with formulas in them are hilighted and you can change all
the cells properties from there.

As far as conditional formatting goes, im not sure

"Lee" wrote:

How do I create conditional formatting based on cell content rather than cell
value? I'm trying to highlight cells with different colors for cells that
contain constants vs. formulas.


Ken Johnson

Conditional Formatting Based on Cell Content
 
On Apr 24, 7:11 am, Lee wrote:
I'm trying to set up a spreadsheet for another user so that it automatically
highlights the cell for them when a formula is overwritten with a constant,
so I was really trying to avoid having the user manually change the format.
Is it possible to incorporate your suggestion into a macro in combination
with the conditional formatting feature?

"akphidelt" wrote:
Not sure if this helps because it doesn't do it in an ongoing basis, but if
you highlight all the cells and go to


Edit--GoTo (Or just press Ctrl + G)
Then click on Special
Then click the box that says formulas and then ok


Now all the cells with formulas in them are hilighted and you can change all
the cells properties from there.


As far as conditional formatting goes, im not sure


"Lee" wrote:


How do I create conditional formatting based on cell content rather than cell
value? I'm trying to highlight cells with different colors for cells that
contain constants vs. formulas.


Hi Lee,

Excel's worksheet functions do not include a function to test for the
presence of a formula. However, VBA has such a method called
HasFormula. So, if you write a User Defined Function (UDF) using the
HasFormula method you can then use it in the conditional formatting
Formula Is box...

Example UDF...

Public Function NowText(Range As Range) As Boolean
If Not Range.HasFormula Then NowText = True
End Function

Then, say you are wanting to test A1 for formula, then in the
conditional Formatting Formula Is box use =NowText(A1) and set the
format.
If A1 has a formula, NowText(A1) = False and the conditional
formatting is NOT applied. If A1s formula has been overwritten then
NowText(A1) = True and the conditional formatting is applied.

The UDF can either be pasted into your Personal Macro Workbook or a
standard code module.

Ken Johnson


All times are GMT +1. The time now is 03:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com