PC Review


Reply
Thread Tools Rate Thread

How can I rewrite IF IsError Function to Work in VBA

 
 
DogLover
Guest
Posts: n/a
 
      27th Nov 2009
I am trying to write this code in VBA. Does anyone know the best code to
make this work?

If (IsError(mSumIfs / Kountifs),"NA", mSumIfs / Kountifs)
 
Reply With Quote
 
 
 
 
JoeU2004
Guest
Posts: n/a
 
      28th Nov 2009
"DogLover" <(E-Mail Removed)> wrote:
> I am trying to write this code in VBA. Does anyone know
> the best code to make this work?
> If (IsError(mSumIfs / Kountifs),"NA", mSumIfs / Kountifs)


One way:

Dim z as Variant
On Error Resume Next
z = mSumIfs / Kountifs
If Err <> 0 Then z = "NA"
On Error GoTo 0

If you meant the Excel error #NA instead of the string "NA", then:

If Err <> 0 Then z = CVErr(xlErrNA)



 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
IF(ISERROR function Greg Microsoft Excel Programming 2 17th Nov 2006 06:06 PM
ISERROR function Len Microsoft Excel Programming 5 21st Apr 2005 02:30 AM
how do I write a vlookup function within an iserror function so t. =?Utf-8?B?SkJMZWVkcw==?= Microsoft Excel Worksheet Functions 2 16th Mar 2005 10:30 AM
iserror function Carl Johnson Microsoft Excel Misc 1 5th Sep 2003 07:51 PM
IsError Function Barry Microsoft Access Reports 1 24th Jul 2003 07:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:00 AM.