Excel 2007 - Error handling

Kesh

Registered User.
Local time
Today, 09:20
Joined
May 15, 2012
Messages
30
I have written a VBA code with the following line

row = Application.WorksheetFunction.Match(ComboBox1.Value, Sheets("Agent Summary Report").Range("A1:A10000"), 0)

it returns the value of the row after value from a combobox (a name) matches a list in another worksheet. If it does not match, the program breaks with an error message.

I do not want the program to break but I want it to display a message such as "Not on report" in a cell

Any help would be much appreciated

Thanking you in anticipation

Kesh
 
Hi, Kesh,

use WorksheetFunction.CountIf in an If..Else..End to deliver either zero results (put your comment in the desired cell and maybe leave the procedure) or a value of 1 or more (normal following of procedure).

I don´t see a need for an error handling when the use of functions may be sufficient to avoid an error message.

Ciao,
Holger
 
Thank you.

I will try this and get back to you.
 

Users who are viewing this thread

Back
Top Bottom