Macro Help! Change Cell Color for Errors and/or Zero Values to White - Across Whole Workbook

RLBrown

New Member
Joined
Aug 6, 2018
Messages
25
Hello Macro Wizards & Wizardesses...

I have a very intricate workbook with several dynamic pivot tables, slicers, links, etc. I've applied conditional formatting to each sheet to handle turning the font color of cells containing either errors or zero values to WHITE which works great until I refresh the pivot tables. I have never been able to learn to write macros but wonder a macro could be the solution to my issue.

Could someone help me with a macro that changes the font color to white (across the workbook) if the cell value is either an error or a zero value?
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
try the following codes
Sub banna()
For a = 1 To Sheets.Count
x = Sheets(a).Cells(Rows.Count, 1).End(xlUp).Row
y = Sheets(a).Cells(1, Columns.Count).End(xlToLeft).Column
For b = 1 To x
For c = 1 To y
If IsError(Sheets(a).Cells(b, c)) = True Then
ElseIf Sheets(a).Cells(b, c) = "0" Then
Sheets(a).Cells(b, c).Font.ColorIndex = 2
Else
End If
Next c
Next b
Next a
MsgBox "complete"
End Sub
it does not seem to pickup error cells. will continue trying on it.
Ravi shankar
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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