Converting a formula into an if function

Joined
Jan 4, 2010
Messages
1
Reaction score
0
Hi

I wondered if someone could help me work out why this function doesn't work please? Basically, I want to be able to select one/more cells, and run a macro that converts the formula so that errors appear as zeros (see below).

Any help would be gratefully received!

Thanks
Paul


Code:
Sub ErrorToIf()
'
	OldContents = ActiveCell.Formula
	OldContents = Right(OldContents, Len(OldContents) - 1)
	ActiveCell.Formula = "=if(iserror(" & OldContents  & ",0," & OldContents & "))"
	
	
End Sub
 
Back
Top