Resume on Error?

  • Thread starter Thread starter dan
  • Start date Start date
D

dan

Hi, I am using this code to get rid of #DIV/0 and other errors:

Range("I5:Q29").Select
Selection.SpecialCells(xlCellTypeFormulas, 16).Select
Selection.ClearContents

However, if there are no errors it stops my code from running and says
it found no cells. How can I have it say if there are none or if there
is an error from this then to skip it and just resume?

Thank you!!!
 
Dan,

Try

Range("I5:Q29").Select
On Error Resume Next
Selection.SpecialCells(xlCellTypeFormulas, xlErrors).Select
If Err.Number = 0 Then
Selection.ClearContents
End If

--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

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