Getting Error on Cond Form VBA - Unable to Bold

bubbapost

Board Regular
Joined
Mar 11, 2009
Messages
116
Hello,

I am getting an error with the code below. The error is "Unable to set the Bold Property of the Font class"

Code:
Sub CFAHTNeg()
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=IF($M6=""Above"",TRUE,FALSE)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
 
With Selection.FormatConditions(1).Font
    .Bold = True
    .Color = 16777215
    .TintAndShade = 0
End With
With Selection.FormatConditions(1).Interior
    .PatternColorIndex = xlAutomatic
    .Color = 255
    .TintAndShade = 0
End With
Selection.FormatConditions(1).StopIfTrue = False
End Sub

Any help would be greatly appreciated! :confused:
 
Last edited:

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
It works for me. I selected a range ( in an unprotected sheet ), with no Conditional Formats there, from M6 to M17, with some of the entries being "Above", and it runs with no errors.

Note, you don't need to put a comparison that results in a True/False inside an IF. This would work:
Formula1:="=$M6=""Above"""
 
Upvote 0

Forum statistics

Threads
1,214,791
Messages
6,121,611
Members
449,038
Latest member
apwr

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top