Check null for range objects

K

kaon

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1
1).SpecialCells(xlCellTypeVisible)
Set rng2
rng.Columns(17).SpecialCells(xlCellTypeVisible)
End with

Hi all,

How can I check if rng and rng2 are null?

I used isNull() and isEmpty(), but both give the wrong answer to me
:(

Thanks
 
N

Norman Jones

Hi Kaon.


If rng is Nothing Then
' do something
End if

or, more usually, the reverse condition:

If not rng is nothing Then
' do something
End if
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top