• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Type mismatch error in IfError and Round Function

Hi,

I don't know why this always return "Type Mismatch" error. I just used the IfError function because I have #DIV/0! in the cell I want to copy and I just wana #DIV/0! to just show "0"
Here is my code:

ThisWorkbook.Sheets("Sheet1").Range("E5").Value = WorksheetFunction.IfError(Round(ThisWorkbook.Sheets("Sheet2").Range("J22").Value, 0), "0")


I hope you can help me. Thank you!
 
Hi Ria,
If you want to use formula in cells, then try below given formual. Insert this formula in cells where you want output as " 0 "

= IFERROR(A1,"0")

Regards
Maunish Patel
 

Attachments

  • IfERROR.xlsx
    8.5 KB · Views: 0
Hi ,

Remove the ROUND ; use :

ThisWorkbook.Sheets("Sheet1").Range("E5").Value = WorksheetFunction.IfError(ThisWorkbook.Sheets("Sheet2").Range("J22").Value, "0")

Narayan
 
Back
Top