Re: unable to get match property of WorksheetFunction class




titus wrote:
I have the following code :

If IsError(Application.WorksheetFunction.Match(cells(x, 1),
Worksheets("Sheet1").Range("A2:A15"), 0)) Then

do this

else

do that

The code works fine when there is a match ( for every cell in column A
of worksheet 2 it finds a match with the range A2:A15 in worksheet 1),
but I get the error 'unable to get match property of WorksheetFunction
class' when there is no match found i.e it gives a #N/A error. I dont
know what this error means. Any ideas ? Thanks

titus

My bad. I searched this group and found the answer. The correct code
is:

If IsError(Application.Match(cells(x, 1),
Worksheets("Sheet1").Range("A2:A15"), 0))

Though I still dont get why application.worksheetfunction.match gave
me the error when it returned #N/A

.



Relevant Pages

  • Re: My addin function wont run twice.
    ... worksheet function first. ... You dont know about my other problem do you? ... >> Dim cell As Excel.Range ...
    (microsoft.public.excel.programming)
  • Re: no of pages in excel worksheet (not workbook)
    ... My excel worksheet runs into several pages. ... and the next few pages are annexures to the initial pages. ... Further this pagination should be dynamic and i dont want to key in the page ... Actually i want to fill a cell in my worksheet which dynamically shows ...
    (microsoft.public.excel.misc)
  • Re: Collating from worksheets
    ... Dont panic... ... > Is it because my sheets are named not just sheet1 etc? ... >>> On each worksheet is collated a number of sums from the data to give me ... >>> the worksheets from the same cell on each worksheet on the summary ...
    (microsoft.public.excel)
  • unable to get match property of WorksheetFunction class
    ... The code works fine when there is a match (for every cell in column A ... of worksheet 2 it finds a match with the range A2:A15 in worksheet 1), ... I dont ...
    (microsoft.public.excel.programming)
  • Re: insert active worksheet name
    ... > i want to insert the active worksheet name into a cell ... > where i dont have to type it every time. ...
    (microsoft.public.excel.worksheet.functions)