excel - IsNumeric/IsError returns an error -


i'm quite new vba , working on custom function (which used more complicated purposes in future - reason want using vba instead of standard formulas) task should date cell , specify position (i.a. row number) within column (e.g. column a).

this simple task have solved following procedure:

function temprownumber(orgdate)     temprownumber = worksheetfunction.match(orgdate, range("a:a"), 0) end function 

it works well, of course. problem is, may happen date entered function not included in range. in case, function should search latest entered date, before date. in range dates sorted chronologically, planned construct error checking formula (as condition) , appropriate loop.

the problem is, if write formula this:

=iserror(match(c23;a:a;0)) 

it's (the formula returns true if date cell c23 found within column a, , false if date not found). if try rewrite formula vba procedure, i.a.:

function finddate(orgdate)  finddate = iserror(worksheetfunction.match(orgdate, range("a:a"), 0))  end function 

the custom function returns #value! error if date not found (and false if it's not).
below attach snapshot describe.

have idea should do? in advance.

i don't know reason behind works:

function finddate(orgdate)     finddate = iserror(application.match(orgdate, range("a:a"), 0)) end function 

logically should work same way worksheetfunction.match , can evaluated iserror same way i've tried , i'm getting same result yours.


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -