Excel VBA - 解释“N / A”值 [英] Excel VBA - Interpret "N/A" Values
问题描述
我正在遍历一个包含价格列的电子表格,格式为 double
类型。我试图找到一个缺少的值,这个电子表格显示为n / a
,但它不是让我把它解释为一个字符串
类型。
I am traversing a spreadsheet which contains a column of prices, in the form of double
types. I am trying to locate a missing value which is shown on the spreadsheet as "n/a"
, but it is not letting me interpret this as a string
type.
包含n / a
的单元格似乎是 integer
type;如何读取这个?
The cell containing "n/a"
seems to be an integer
type; how can I read this?
推荐答案
VBA检索包含#N / A的单元格作为一个变体,包含错误代码
A cell containing #N/A is retrieved by VBA as a variant containing an error code
一般来说,通常最好将Excel单元格分配给Variants,因为单元格可以包含数字(双),逻辑,字符串或错误,您不能提前告知单元格将包含。
In general its usually best to assign Excel cells to Variants because a cell can contain a number(double), logical, string or error and you cannot tell in advance what the cell wil contain.
这篇关于Excel VBA - 解释“N / A”值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!