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

  • Thread starter Thread starter JMay
  • Start date Start date
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
 
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
 

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

Back
Top