Sub DemoEmptyRange()
Dim r As Range
Set r = Intersect(Range("A1:B2"), Range("C3:D4"))
If r Is Nothing Then
MsgBox "r is null"
Else
MsgBox r.Address
End If
End Sub
Zathras is absolutely correct. Nothing is as close to Null as Excel gets. I suspect, given the title however, that you may want to check for the cells in the range all being empty - if so, here is one way ...
Code:
[blue]Set FR = Range("A1:X10") [green]' Perhaps[/green]
If Evaluate("=COUNTA(" & FR.Address & ")") = 0 Then
MsgBox "Range is empty"
Else
MsgBox "Range is not empty"
End If[/blue]
Enjoy,
Tony
-------------------------------------------------------------------------------------------- We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at VBAExpress[
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.