Delete Red Fonts

hartless43

New Member
Joined
Dec 28, 2022
Messages
41
Office Version
  1. 365
Platform
  1. Windows
Below is a code that a user place here about 5 years ago and it still works.

Excel Formula:
Sub DeleteRedFont()
Dim rng As Range

Set rng = [B2:J2]
For Each cell In rng
 If cell.Font.ColorIndex = 3 Then
  cell.ClearContents
 End If
Next cell

End Sub

This will delete any cell with a red font. However, if it was created from Conditional Formatting it won't delete it. So, is there a work around this?
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Use
VBA Code:
If cell.Displayformat.Font.ColorIndex = 3 Then
 
Upvote 0
Solution
Thanks, Fluff, I have been looking for this answer for a long time and yours works.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,225,335
Messages
6,184,338
Members
453,227
Latest member
Slainte

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