Getting r/t 13 - Type Mismatch on this line - Why?

B

Bob Phillips

You need to cater for none being found, and test for Nothing not True. And
best to use the builtin constant, not its value

Dim rng As Range

On Error Resume Next
Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeComments)
On Error GoTo 0
If Not rng Is Nothing Then

MsgBox "comments"
End If
 
J

JMay

appreciate the 3 (important) pointers!!


Bob Phillips said:
You need to cater for none being found, and test for Nothing not True. And
best to use the builtin constant, not its value

Dim rng As Range

On Error Resume Next
Set rng = ActiveSheet.UsedRange.SpecialCells(xlCellTypeComments)
On Error GoTo 0
If Not rng Is Nothing Then

MsgBox "comments"
End If


--
__________________________________
HTH

Bob
 
Top