Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 38
Default macro - replace

hi, i have various worksheets and within that worksheet there are cells
having #DIV/0!. I want this to be replace by zero. i know there is a
formula which will give out zero but if someone can write a macro would good.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 22,906
Default macro - replace

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 Thu, 25 Mar 2010 20:11:01 -0700, Rohit
wrote:

hi, i have various worksheets and within that worksheet there are cells
having #DIV/0!. I want this to be replace by zero. i know there is a
formula which will give out zero but if someone can write a macro would good.

Thanks


  #3   Report Post  
Posted to microsoft.public.excel.newusers
external usenet poster
 
Posts: 3,942
Default macro - replace

hi
the formula is the microsoft way of dealing with the problem.
see this site.
http://support.microsoft.com/kb/182188
i know of no macro command that would make the #DEV/0! error go away other
than to replace the formula with zero or replace the formula with the above
formula.

regards
FSt1

"Rohit" wrote:

hi, i have various worksheets and within that worksheet there are cells
having #DIV/0!. I want this to be replace by zero. i know there is a
formula which will give out zero but if someone can write a macro would good.

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to replace puiuluipui Excel Discussion (Misc queries) 4 January 7th 10 12:23 PM
Macro-replace puiuluipui Excel Discussion (Misc queries) 10 September 20th 09 12:59 PM
Replace Macro Sandy Mann Excel Discussion (Misc queries) 8 December 5th 07 03:05 PM
find&replace macro Elainey Excel Worksheet Functions 0 January 6th 06 09:20 PM
replace macro? andrewm Excel Worksheet Functions 1 October 19th 05 12:47 PM


All times are GMT +1. The time now is 02:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"