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
 

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

Similar Threads

formula through inputbox 4
Quote in equation causing error 4
code help 7
slow macro 3
Adding Sub code in Function module 4
format a formula to general (not text) 4
Cell formula 3
Help with Index formula 2

Back
Top