PC Review


Reply
Thread Tools Rate Thread

Check for #NA in VB?

 
 
fedude
Guest
Posts: n/a
 
      10th Apr 2008
Is there a way I can check to see if a cells formula resolves to #NA. It
doesn't appear that ISNA or NA() are available in excel vb
 
Reply With Quote
 
 
 
 
JP
Guest
Posts: n/a
 
      10th Apr 2008
You can use certain worksheet functions directly in VBA, if there is
no VBA equivalent. Just preface them with "Worksheetfunction" for
example

Sub Clear_ISNA()
Dim cell As Excel.Range

Application.ScreenUpdating = False

For Each cell In Selection
If WorksheetFunction.IsNA(cell) = True Then cell.ClearContents
Next cell

Application.ScreenUpdating = True

End Sub


HTH,
JP

On Apr 10, 4:55*pm, fedude <fed...@discussions.microsoft.com> wrote:
> Is there a way I can check to see if a cells formula resolves to #NA. * It
> doesn't appear that ISNA or NA() are available in excel vb


 
Reply With Quote
 
IanKR
Guest
Posts: n/a
 
      10th Apr 2008
> Is there a way I can check to see if a cells formula resolves to #NA. It
> doesn't appear that ISNA or NA() are available in excel vb


use WorksheetFunction.IsNA()...

 
Reply With Quote
 
fedude
Guest
Posts: n/a
 
      10th Apr 2008
ISNA() is not available as a worksheet function in VB.

"IanKR" wrote:

> > Is there a way I can check to see if a cells formula resolves to #NA. It
> > doesn't appear that ISNA or NA() are available in excel vb

>
> use WorksheetFunction.IsNA()...
>
>

 
Reply With Quote
 
fedude
Guest
Posts: n/a
 
      10th Apr 2008
I'm pretty sure that ISNA() is not avaialble as a worksheet function in VB.
I need an alternative.

application.worksheetfunction.isna() <== does not exist in VB

"JP" wrote:

> You can use certain worksheet functions directly in VBA, if there is
> no VBA equivalent. Just preface them with "Worksheetfunction" for
> example
>
> Sub Clear_ISNA()
> Dim cell As Excel.Range
>
> Application.ScreenUpdating = False
>
> For Each cell In Selection
> If WorksheetFunction.IsNA(cell) = True Then cell.ClearContents
> Next cell
>
> Application.ScreenUpdating = True
>
> End Sub
>
>
> HTH,
> JP
>
> On Apr 10, 4:55 pm, fedude <fed...@discussions.microsoft.com> wrote:
> > Is there a way I can check to see if a cells formula resolves to #NA. It
> > doesn't appear that ISNA or NA() are available in excel vb

>
>

 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Apr 2008
You could also look at what's displayed in the cell

if lcase(somerange.text) = lcase("#n/a") then

or if you're satisfied just looking for any old error:

if iserror(somerange.value) then


fedude wrote:
>
> Is there a way I can check to see if a cells formula resolves to #NA. It
> doesn't appear that ISNA or NA() are available in excel vb


--

Dave Peterson
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Apr 2008
Look again.

fedude wrote:
>
> ISNA() is not available as a worksheet function in VB.
>
> "IanKR" wrote:
>
> > > Is there a way I can check to see if a cells formula resolves to #NA. It
> > > doesn't appear that ISNA or NA() are available in excel vb

> >
> > use WorksheetFunction.IsNA()...
> >
> >


--

Dave Peterson
 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Apr 2008
Look again. You may be surprised.

fedude wrote:
>
> I'm pretty sure that ISNA() is not avaialble as a worksheet function in VB.
> I need an alternative.
>
> application.worksheetfunction.isna() <== does not exist in VB
>
> "JP" wrote:
>
> > You can use certain worksheet functions directly in VBA, if there is
> > no VBA equivalent. Just preface them with "Worksheetfunction" for
> > example
> >
> > Sub Clear_ISNA()
> > Dim cell As Excel.Range
> >
> > Application.ScreenUpdating = False
> >
> > For Each cell In Selection
> > If WorksheetFunction.IsNA(cell) = True Then cell.ClearContents
> > Next cell
> >
> > Application.ScreenUpdating = True
> >
> > End Sub
> >
> >
> > HTH,
> > JP
> >
> > On Apr 10, 4:55 pm, fedude <fed...@discussions.microsoft.com> wrote:
> > > Is there a way I can check to see if a cells formula resolves to #NA. It
> > > doesn't appear that ISNA or NA() are available in excel vb

> >
> >


--

Dave Peterson
 
Reply With Quote
 
fedude
Guest
Posts: n/a
 
      10th Apr 2008
OOPS. ISNA() is available. It just didn't show up in my drop-down function
list. NA() is not available.
Thanks!

"Dave Peterson" wrote:

> Look again. You may be surprised.
>
> fedude wrote:
> >
> > I'm pretty sure that ISNA() is not avaialble as a worksheet function in VB.
> > I need an alternative.
> >
> > application.worksheetfunction.isna() <== does not exist in VB
> >
> > "JP" wrote:
> >
> > > You can use certain worksheet functions directly in VBA, if there is
> > > no VBA equivalent. Just preface them with "Worksheetfunction" for
> > > example
> > >
> > > Sub Clear_ISNA()
> > > Dim cell As Excel.Range
> > >
> > > Application.ScreenUpdating = False
> > >
> > > For Each cell In Selection
> > > If WorksheetFunction.IsNA(cell) = True Then cell.ClearContents
> > > Next cell
> > >
> > > Application.ScreenUpdating = True
> > >
> > > End Sub
> > >
> > >
> > > HTH,
> > > JP
> > >
> > > On Apr 10, 4:55 pm, fedude <fed...@discussions.microsoft.com> wrote:
> > > > Is there a way I can check to see if a cells formula resolves to #NA. It
> > > > doesn't appear that ISNA or NA() are available in excel vb
> > >
> > >

>
> --
>
> Dave Peterson
>

 
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
Spell check -- text marked skip spelling and grammar check =?Utf-8?B?RGF2aWQgQS4=?= Microsoft Word Document Management 8 9th Aug 2008 11:47 PM
Asp.net Treeview Clientscript - Auto Check Child Notes After Check Parent Node Sylvie Microsoft C# .NET 1 9th Oct 2007 02:25 PM
Treeview Clientscript - Auto Check Child Notes After Check Parent Node Sylvie Microsoft ASP .NET 1 9th Oct 2007 02:25 PM
In outlook get message "Spell check cannot check items...try agai =?Utf-8?B?am1yYW5jaG1hbg==?= Microsoft Outlook Discussion 1 28th Sep 2006 10:26 PM
Xp:Check Disk:Tools:Check Now:Both Options:reboot countdown does not complete? RAS Windows XP General 3 1st Feb 2005 06:23 AM


Features
 

Advertising
 

Newsgroups
 


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