Conditional Formatting VBA Font Type

mdonovan890

New Member
Joined
Dec 22, 2016
Messages
24
if Column C contains "QC SDMA Feline" I would like the font type of Column B to change from Calibri to another font type such as Arial Black. I am thinking I would need some sort of VBA to accomplish this? I am using Excel 2016 and relatively new to using VBA.

14ncjnn.jpg


piJENZn
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
You don't need to use VBA, select the column range in Coilumn C use the Home and Conditional formatting and select Highlight Rules (First choice) and Contains Type in what you want it to look for and format accordingly.
 
Last edited:
Upvote 0
You do need VBA because you can't change font name using conditional formatting. Assuming column C is a manual entry and not a formula, you could use a change event:

Code:
Private sub worksheet_change(byval target as Range)
dim cell as range
if not intersect(target, Range("C:C")) is nothing then
for each cell in intersect(target, Range("C:C")).cells
if instr(1, cell.value, "QC SDMA Feline", vbtextcompare) <> 0 then
cell.font.name = "Arial Black"
Else
cell.font.name = "Calibri"
End If
next cell
end if
end sub

Note that this is air code so may not be entirely accurate!

To enter the code, right click the worksheet tab, choose View Code and then paste that in.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

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