Home |
Search |
Today's Posts |
#10
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
Sub ErrorTrapAdd()
Dim mystr As String Dim cel As Range For Each cel In Selection If cel.HasFormula = True Then If Not cel.Formula Like "=IF(ISERROR*" Then mystr = Right(cel.Formula, Len(cel.Formula) - 1) cel.Value = "=IF(ISERROR(" & mystr & "),0," & mystr & ")" End If End If Next End Sub Gord Dibben MS Excel MVP On Tue, 6 Apr 2010 10:48:04 -0700, Jamie wrote: Hi, Can anyone write a macro for me so that it takes the current formula I have in a cell and adds a IF function and iserror fuction around it. Here is what I would like: Current formula =A1/B1 after running the macro I would like it to look like this: =if(iserror(A1/B1),0,A1/B1) Thanks for your help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating a Macro the right way? | Excel Worksheet Functions | |||
VBA and creating a Macro | Excel Discussion (Misc queries) | |||
Creating a New Macro | Excel Discussion (Misc queries) | |||
Creating a macro | New Users to Excel | |||
Need Help Creating A Macro | Excel Worksheet Functions |