ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   conditional formatting: if no formula, set fontface to bold (https://www.excelbanter.com/excel-programming/378392-conditional-formatting-if-no-formula-set-fontface-bold.html)

John Smith

conditional formatting: if no formula, set fontface to bold
 
I would like to set a cell's fontface to bold if it contains no
formula. I selected format/conditional formatting... then "formula
is" and left the other box blank. This does not do what I want it
to do.

What is the proper way of doing it? Thanks.

Gary Keramidas

conditional formatting: if no formula, set fontface to bold
 
you can give this try.

just use a range if you want to narrow it down

Sub Formula_bold()

Dim cell As Range
Application.ScreenUpdating = False
ActiveSheet.Unprotect
For Each cell In Cells.SpecialCells(xlFormulas, 23)
cell.Font.Bold = True
Next cell

Application.ScreenUpdating = True
End Sub



--


Gary


"John Smith" wrote in message
...
I would like to set a cell's fontface to bold if it contains no
formula. I selected format/conditional formatting... then "formula
is" and left the other box blank. This does not do what I want it
to do.

What is the proper way of doing it? Thanks.




MarMo

conditional formatting: if no formula, set fontface to bold
 
John,
As far as Iknow , you will not be able to achive this with the conditional
formatting tool.
Instead you should create a tool yourself in VBE
Something like :

Sub SetConFormat()
If ActiveCell.HasFormula Then
ActiveCell.Font.Bold = True
End If
End Sub

You could use this in a do... loop to set a area of cell in this format

Hope this will help
Mario

"John Smith" wrote in message
...
I would like to set a cell's fontface to bold if it contains no
formula. I selected format/conditional formatting... then "formula
is" and left the other box blank. This does not do what I want it
to do.

What is the proper way of doing it? Thanks.




JMay

conditional formatting: if no formula, set fontface to bold
 
Created this UDF (In a standard module):

Public Function HasNotFormula(rngCell As Range) As Boolean
On Error Resume Next
If Left$(rngCell.Formula, 1) < "=" Then
HasNotFormula = True
End If
End Function

Then in the Conditional Formatting Box:
Formula IS =HasNotformula(A1) Format...
Select Bold
OK Out

HTH

"John Smith" wrote in message
:

I would like to set a cell's fontface to bold if it contains no
formula. I selected format/conditional formatting... then "formula
is" and left the other box blank. This does not do what I want it
to do.

What is the proper way of doing it? Thanks.




All times are GMT +1. The time now is 07:10 PM.

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