Excel VBA - 检测无效引用的函数
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9970387/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Excel VBA - Function to Detect Invalid Reference
提问by Steveng
I am new to excel vba. Is there any function that would detect the cell value as #REF!
?
我是 excel vba 的新手。是否有任何函数可以将单元格值检测为#REF!
?
回答by chris neilsen
Assuming CellReference
references a cell,
假设CellReference
引用一个单元格,
To detect anyerror, use If IsError(CellReference) Then
要检测任何错误,请使用If IsError(CellReference) Then
To detect #REF!
specifically use If CellReference = CVErr(xlErrRef) Then
检测#REF!
具体使用If CellReference = CVErr(xlErrRef) Then