Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 检查单元格是否为空_Vb.net_Excel - Fatal编程技术网

Vb.net 检查单元格是否为空

Vb.net 检查单元格是否为空,vb.net,excel,Vb.net,Excel,我试图检查tstDash表中的单元格(A5)是否为空。当前单元格包含一个公式,但有时为空,有时为数字 如果为空,我需要一个消息框。否则执行其他功能 我有这个代码,但它完全忽略了行,给我适合 If chk25thPercentile.Checked = True And Globals.tsdDash.Range("A5").Value Is DBNull.Value 试试这个 If chk25thPercentile.Checked And IsDBNull(Globals.tsdDash.R

我试图检查tstDash表中的单元格(A5)是否为空。当前单元格包含一个公式,但有时为空,有时为数字

如果为空,我需要一个消息框。否则执行其他功能

我有这个代码,但它完全忽略了行,给我适合

If chk25thPercentile.Checked = True And Globals.tsdDash.Range("A5").Value Is DBNull.Value
试试这个

If chk25thPercentile.Checked And IsDBNull(Globals.tsdDash.Range("A5").Value)

你用什么语言写的?VBA还是VB.Net?VBA不接受IsDBNull。如果您在VBA中,您要测试公式的空白结果,它可能只是一个空字符串“”。 我想你需要像这样的东西

If chk25thPercentile.Checked And Globals.tsdDash.Range("A5").Value = ""

这是假设公式的结果是空字符串,如果单元格实际上是空的,也就是说,如果没有公式,您可能希望查看ISBLANK

我正在使用VB.net和Option Strict On