+ Reply to Thread
Results 1 to 4 of 4

VBA and #N/A

  1. #1
    Registered User
    Join Date
    10-25-2004
    Posts
    88

    VBA and #N/A

    I can check whether a cell has a value of #N/A by using
    WorksheetFunction.IsNa(CellAddress).

    But can I put a #N/A value into a cell? There seems to be no equivalent of the
    NA() function that you can use directly in a worksheet. Something like
    Range(CellAddress).Value=NA() ???

    Putting the string equivalent "#N/A" into the cell doesn't help, because the spreadsheet has to function in a multilanguage environment.

  2. #2
    JE McGimpsey
    Guest

    Re: VBA and #N/A

    One way:

    Range(CellAddress).Value = CVErr(xlErrNA)

    In article
    <[email protected]>,
    rvExcelNewTip
    <[email protected]> wrote:

    > I can check whether a cell has a value of #N/A by using
    > WorksheetFunction.IsNa(CellAddress).
    >
    > -But can I put a #N/A value into a cell?- There seems to be no
    > equivalent of the
    > NA() function that you can use directly in a worksheet. Something
    > like
    > Range(CellAddress).Value=NA() ???
    >
    > Putting the string equivalent "#N/A" into the cell doesn't help,
    > because the spreadsheet has to function in a multilanguage environment.


  3. #3
    Dave Peterson
    Guest

    Re: VBA and #N/A

    Maybe you could try:

    with range(celladdress)
    .formula = "=na()"
    .value = .value
    end with

    But I bet this would work, too:

    range(celladdress).value = cverr(xlerrna)

    rvExcelNewTip wrote:
    >
    > I can check whether a cell has a value of #N/A by using
    > WorksheetFunction.IsNa(CellAddress).
    >
    > -But can I put a #N/A value into a cell?- There seems to be no
    > equivalent of the
    > NA() function that you can use directly in a worksheet. Something
    > like
    > Range(CellAddress).Value=NA() ???
    >
    > Putting the string equivalent "#N/A" into the cell doesn't help,
    > because the spreadsheet has to function in a multilanguage environment.
    >
    > --
    > rvExcelNewTip
    > ------------------------------------------------------------------------
    > rvExcelNewTip's Profile: http://www.excelforum.com/member.php...o&userid=15668
    > View this thread: http://www.excelforum.com/showthread...hreadid=376276


    --

    Dave Peterson

  4. #4
    Registered User
    Join Date
    10-25-2004
    Posts
    88
    CVErr(xlErrNA) works like a charm. Thanks!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1