Excel Visual Basic - 检测范围是否为空 [英] Excel Visual Basic - detect if range is empty
本文介绍了Excel Visual Basic - 检测范围是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道是否可行,但我想检查Excel中的范围是否为空。那么我如何写:
I don't know if it's possible, but I want to check if a range in Excel is empty. So how do I write if:
Range("A38":"P38")
VBA代码中为空?
Is empty in VBA code?
提前感谢
推荐答案
从评论中找到解决方案我得到了。
Found a solution from the comments I got.
Sub Empty()
If WorksheetFunction.CountA(Range("A38:P38")) = 0 Then
MsgBox "Empty"
Else
MsgBox "Not Empty"
End If
End Sub
这篇关于Excel Visual Basic - 检测范围是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文