ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA and #N/A (https://www.excelbanter.com/excel-programming/330862-vba-n.html)

rvExcelNewTip

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.


--
rvExcelNewTip
------------------------------------------------------------------------
rvExcelNewTip's Profile: http://www.excelforum.com/member.php...o&userid=15668
View this thread: http://www.excelforum.com/showthread...hreadid=376276


JE McGimpsey

VBA and #N/A
 
One way:

Range(CellAddress).Value = CVErr(xlErrNA)

In article
,
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.


Dave Peterson[_5_]

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

rvExcelNewTip[_2_]

VBA and #N/A
 

-CVErr(xlErrNA)- works like a charm. Thanks

--
rvExcelNewTi
-----------------------------------------------------------------------
rvExcelNewTip's Profile: http://www.excelforum.com/member.php...fo&userid=1566
View this thread: http://www.excelforum.com/showthread.php?threadid=37627



All times are GMT +1. The time now is 09:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com