View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
GoodyA10 GoodyA10 is offline
external usenet poster
 
Posts: 3
Default Delete the contents of a cell if it contains #DIV/0! Automatic

Thanks for that both solutions did the trick.

Cheers

"Jacob Skaria" wrote:

Its better to handle the error within the formula itself.

If =A1/B1 returns an error change the formula to

=IF(N(B1),A1/B1,"")


You can try out the below macro. If you are new to macros..

--Set the Security level to low/medium in (Tools|Macro|Security).
--From workbook launch VBE using short-key Alt+F11.
--From menu 'Insert' a module and paste the below code.
--Get back to Workbook.
--Run macro from Tools|Macro|Run <selected macro()


Sub Macro()
Dim cell As Range
For Each cell In ActiveSheet.UsedRange
If cell.Text = "#DIV/0!" Then cell.ClearContents
Next
End Sub


--
Jacob (MVP - Excel)


"GoodyA10" wrote:

I am building an execl sheet that holds production data. Some pieces of
equipment only run occasionally and because of this they cause a #DIV/0!
error. I want to be able to look through the complete range (a1:di54) of
cells and whenver I find the error i want to delete the contents of the cell.
I guess this is possible to do using a Visual Basic module but my experience
of Visual Basic is limited.