Help: iserror in VBA

Kingnight

New Member
Joined
Feb 5, 2011
Messages
38
Hey,

I am trying to do a very easy user-defined function. I am trying to check if errors in one cell, returns black, otherwise returns what is in the cell.

Here is my formula:

Function errors(anything As Variant) As Variant

If IsError(anything) Then

errors = ""

Else

errors = anything

End If

End Function

But it does not work.... Is there anyone who could tell where it is wrong. I greatly appreciate it. :confused::confused::confused::confused:
 

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.
Works for me, in what way does it not work for you?

Are you expecting it to remove the error from the original cell (anything) ?
It will not do that.
A UDF cannot modify the values of OTHER cells, it can only return a value to the cell the function is entered in.

All it does is return blank if the reference is an error, otherwise returns the value of the reference.
 
Upvote 0
Works for me, in what way does it not work for you?

Are you expecting it to remove the error from the original cell (anything) ?
It will not do that.
A UDF cannot modify the values of OTHER cells, it can only return a value to the cell the function is entered in.

All it does is return blank if the reference is an error, otherwise returns the value of the reference.

Thanks! Here is exactly what I want to do.

Here is data:
1 11 (it has own formulas)
2 GG (it has own formulas)
3 #value (it has own formulas)

If cell = #value, it will return blank, otherwise use what is in the cells.

My forumas does not work...:confused::confused::confused::confused
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,626
Members
452,933
Latest member
patv

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