Code to remove specific font colour from cells across workbook?

NDERE96

New Member
Joined
Sep 13, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I'm look for some code that can help me to replace a specic font colour from every used cell across a workbook. Specifically trying to change text colour from Red to Black for whichever cells that apply across a number of different sheets.

*I'm comepletely new to VBA so any help will be appreciated.
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.
Hi & welcome to MrExcel.
How about
VBA Code:
Sub ndere()
   Dim Ws As Worksheet
   
   With Application
      .FindFormat.Clear
      .ReplaceFormat.Clear
      .FindFormat.Font.Color = vbRed
      .ReplaceFormat.Font.ColorIndex = xlAutomatic
   End With
   For Each Ws In Worksheets
      Ws.UsedRange.Replace "?", "", , , , , True, True
   Next Ws
   With Application
      .FindFormat.Clear
      .ReplaceFormat.Clear
   End With
End Sub
 
Upvote 0
Hi & welcome to MrExcel.
How about
VBA Code:
Sub ndere()
   Dim Ws As Worksheet
  
   With Application
      .FindFormat.Clear
      .ReplaceFormat.Clear
      .FindFormat.Font.Color = vbRed
      .ReplaceFormat.Font.ColorIndex = xlAutomatic
   End With
   For Each Ws In Worksheets
      Ws.UsedRange.Replace "?", "", , , , , True, True
   Next Ws
   With Application
      .FindFormat.Clear
      .ReplaceFormat.Clear
   End With
End Sub
Hi I tried this and it didn't work at all?
 
Upvote 0
What colour red are you using?
 
Upvote 0
Should also mention that some cells have both black and red text in them and I'm just looking to recolour the red text.
That is completely different.
Roughly how many used cells do you have, as the code will need to loop through every character in every cell, so it could take a while.
 
Upvote 0
That is completely different.
Roughly how many used cells do you have, as the code will need to loop through every character in every cell, so it could take a while.
Lets say around 800ish lines and 27 columns to be exact. I was also planning on using this for a workbook that has a different no. of rows and columns across several worksheets.
 
Upvote 0
Do you have any othered coloured text, or is it just red & black?
 
Upvote 0
Do you have any othered coloured text, or is it just red & black?
There are a few cells that have Dark blue text in them aswell e.g. RGB (0,112,192). Might be others too.

In essence, all I'm looking for is all Non- black text (excluding White text) to be changed to Black, if that helps?
 
Upvote 0

Forum statistics

Threads
1,214,980
Messages
6,122,563
Members
449,088
Latest member
Motoracer88

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