Macro to change font color of cells with VBRed, VBBlue, or VBGreen to Black:
Sub ChangeFontColorToBlack()
Dim cell As Range
For Each cell In Selection
If cell.Font.Color = RGB(255, 0, 0) Or _
cell.Font.Color = RGB(0, 0, 255) Or _
cell.Font.Color = RGB(0, 176, 80) Then
cell.Font.Color = RGB(0, 0, 0) 'Change font color to Black
End If
Next cell
End Sub
Macro to revert font color of cells back to VBRed, VBBlue, or VBGreen:
Sub RevertFontColor()
Dim cell As Range
For Each cell In Selection
If cell.Font.Color = RGB(0, 0, 0) Then
If cell.Interior.Color = RGB(255, 0, 0) Or _
cell.Interior.Color = RGB(0, 0, 255) Or _
cell.Interior.Color = RGB(0, 176, 80) Then
cell.Font.Color = cell.Interior.Color 'Revert font color
End If
End If
Next cell
End Sub
You can add these macros to your Quick Access Toolbar by following these steps:
Press Alt + F11 to open the VBA editor.
In the VBA editor, go to Insert > Module to insert a new module.
Copy and paste the respective macro codes into the module window.
Close the VBA editor.
Right-click on the Quick Access Toolbar and select Customize Quick Access Toolbar.
In the Choose commands from dropdown, select Macros.
Add the macros to your Quick Access Toolbar by selecting them from the list and clicking Add.
Click OK to close the dialog box.
Now you can use these macros directly from your Quick Access Toolbar in Excel.