VBA insert IF(ISERROR( into Block of Cells

Delvesy888

New Member
Joined
Aug 13, 2013
Messages
5
Hi guys,

I am relatively new to VBA and am trying to create a function that takes my original cell with function "Original Cell Function" and changes it to IF(ISERROR(Original Cell Function),"",Original Cell Function).

I want this to be done on a block of cells, from A1 to R18

The VBA code I have tried is:

Sub IFERROR()

For j = 1 to 18
For i =1 to 18

what_in_the_cell = Range ("A1").Formula

new_cell_formula = "IF(ISERROR(" & what_in_the_cell & " ,"", " & what_in_the_cell & ")"

Range("A1").Offset(i,j).Formula

Next i
Next j

End Sub


I hope it is clear what I am trying to do.
But when I am in VBA and click 'run' I get an error:- "Compile error: Invalid use of property"

Then the Sub IFERROR() gets highlighted yellow. But I am unsure on the problem.

Thanks in advance for any help!
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try
Code:
Sub addIffErr()
Dim i As Range
 For Each i In Range("A1:R18").SpecialCells(xlCellTypeFormulas)
            i.Formula = "=IFERROR(" & Right(i.Formula, Len(i.Formula) - 1) & ","""")"
        Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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