ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Check null for range objects (https://www.excelbanter.com/excel-programming/307818-check-null-range-objects.html)

kaon[_45_]

Check null for range objects
 
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

--
Message posted from http://www.ExcelForum.com


Norman Jones

Check null for range objects
 
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
--

---
Regards,
Norman



"kaon " wrote in message
...
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.


---
Message posted from http://www.ExcelForum.com/




kaon[_47_]

Check null for range objects
 
Thanks for ur quick reply

--
Message posted from http://www.ExcelForum.com



All times are GMT +1. The time now is 02:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com