Replacing data using the cell value not the formula

H

Hunter1978

Hi all,

I'm trying to replace data in a cell range using the cell's valu
instead of it using the formula.

I'm using the following code:-

ActiveSheet.Range("I:I").Select
Selection.Replace What:="#N/A", Replacement:="0"
LookAt:=xlPart, LookIn:=xlValues, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False
_
ReplaceFormat:=False

However, when I run the macro it errors at this point.

Basically, I'm trying to remove the dreaded #N/A and replace it with
0. Is there an easier way of doing this??

Thanks
 
N

NickHK

Why not include it in your formula:
=If(ISNA(<YourFormula>),0,<YourFormula>)

NickHK
 
H

Hunter1978

Hi NickHK,

Thanks for your answer.

It seemd to have done the trick!

Many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top