A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Hi Nitsuj5,
Try:
'=========>>
Sub Add_IF_Selection()
Dim myCell As Range
Dim sStr As String
For Each myCell In Selection.Cells
If myCell.HasFormula And Not myCell.HasArray Then
sStr = Mid(myCell.Formula, 2)
myCell.Formula = "=IF(" & sStr & "=0,""""," & sStr & ")"
End If
Next
End Sub
'<<=========
Note that you need to allow for the initial = sign and you need to double up internal quotes.
===
Regards,
Norman