单元格为空,但IsEmpty不工作 [英] Cell is empty but IsEmpty is not working

查看:217
本文介绍了单元格为空,但IsEmpty不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一个IF语句,它使用IsEmpty函数来确定是否为True。
我在一个具有值的单元格(例如,PRB2039)和一个空白单元格上尝试了测试我的代码,结果是一样的。



我删除了格式,并在新的工作表上尝试过。

解决方案

根据@PatricK的建议,您可以考虑使用ISBLANK功能而不是IsEmpty函数。 ISBLANK 函数如果值为空,则返回TRUE





使用VBA

  Sub test()

对于i = 1至4
MsgBox Evaluate(isblank(& Cells(i,1).Address& ))
下一个

End Sub


I am writing an IF statement that uses the IsEmpty function to determine if True or False. I tried it both on a cell with a value (e.g., PRB2039) and on a blank cell to test my code, and the result is the same.

I removed formatting, and tried it on a new worksheet. I don't know what I'm doing wrong.

解决方案

As suggested by @PatricK you may consider using ISBLANK function instead of IsEmpty function. ISBLANK function Returns TRUE if the value is blank

Using VBA

Sub test()

    For i = 1 To 4
       MsgBox Evaluate("isblank(" & Cells(i, 1).Address & ")")
    Next

End Sub

这篇关于单元格为空,但IsEmpty不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆