Thread: Errors
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
johncassell[_14_] johncassell[_14_] is offline
external usenet poster
 
Posts: 1
Default Errors


Hello, I am not too familiar with errors in my code and was hoping for
some help with this please.

I have a control box linked to a stock spreadsheet. After I update this
box(Which is for the stock number), the label next to it will update
with the stock item description. My code does a vlookup for this
value:

Public Sub BinNumber1_AfterUpdate()
Description1 = (WorksheetFunction.VLookup(BinNumber1.Value,
Worksheets("Current Stock").Range("A:B"), 2, False))
End Sub

This works fine if a valid stock number is entered but if someone
enters a bogus number I would like my msgbox to appear saying "Bad
stock number blah blah.." instead of VB opening for debugging.

Thanks in advance for any help.

John


--
johncassell
------------------------------------------------------------------------
johncassell's Profile: http://www.excelforum.com/member.php...o&userid=25016
View this thread: http://www.excelforum.com/showthread...hreadid=391660