Hide all #div/0 until data entered in (Hide all at once)

dsrt16

Board Regular
Joined
Jun 18, 2005
Messages
208
I know how to use the IF formula to remove the #div/0! from cells containing formulas that don't have data yet for them to work. However, I have a few, and I don't want to go through each one and add the IF statement. In previous workbooks, I put the formula in the IF (isblank) right from the start. But I didn't on this one, and the thought of going in and changing them all isn't a happy one right now.

Is there a macro that will do this for all the formulas in the entire workbook? The formulas are all Average() formulas. If not, I can certainly go through and add it in each row with that and drag it across to change them all, but I am just hoping to avoid that.
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
Try something like this:

Code:
For Each sh In ThisWorkbook.Worksheets
    For Each c In sh.UsedRange
        If c.HasFormula = True Then
            If InStr(LCase(c.Formula), "average") > 0 Then
                If InStr(LCase(c.Formula), "iferror") = 0 Then
                    c.Formula = "=IFERROR(" & Mid(c.Formula, 2, Len(c.Formula)) & ",""ERROR"")"
                End If
            End If
        End If
    Next
Next
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,194
Members
453,021
Latest member
pingpong7117

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