#N/B error processing

Hans810

Board Regular
Joined
Dec 1, 2005
Messages
63
Dear all,

I have the following problem:
In a VBA Excel programme, I am checking the value of an array of cells. In some cells are numerical values. That is okay. But sometimes I have #N/B as value in the cell (the worksheet is delivered to me by a supplier) and then the VBA programme comes to a halt. How can I eliminate the #N/B, or better neglect the error message and continue with my programme?

Thx in advance
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Hello Hans

Do you mean #N/A error (or is it different in the Netherlands)?

Can you share your code with us? If you are looping thru a range then you could always use On Error Resume Next before the loop, but it may be better to handle the errors differently / directly.
 
Upvote 0
Ok

Here is an example of how you would loop thru a range and have it execute only where the cell does not house an error:

<font face=Courier New><SPAN style="color:#00007F">For</SPAN> <SPAN style="color:#00007F">Each</SPAN> c <SPAN style="color:#00007F">In</SPAN> MyRange<br>    <SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> IsError(c) <SPAN style="color:#00007F">Then</SPAN><br>        MsgBox "do something"<br>    <SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN><br><SPAN style="color:#00007F">Next</SPAN> c</FONT>

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,820
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top