Can anybody explain me how the IsError function exactly works?
I still want to check if a city is already in a list and I had the idea to do it with IsError, but it seems that's someting is always going wrong
Can anybody explain me how the IsError function exactly works?
I still want to check if a city is already in a list and I had the idea to do it with IsError, but it seems that's someting is always going wrong
As help says, IsError Returns a Boolean value indicating whether an expression is an error value. Unfortuantely, not all expressions return an error value, they might abort. For instance Application.function_name works okay (mainly) with IsError, WorksheetFunction.function_name genearlly does not.
Personally, I avoid IsError in favour of On Error Resum Next:code:On Error Goto 0, unless I just want to know if say a Match function works.
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
The problem is that the help on my computer at the office isn't installed and the guy with the cd's is not here this week, so I'm asking it this way.
What does the Match function do?
The purpose is that a value is being checked if it appears in a list. Can I do it with the Match function?
What bright-spark thought up that policy, have the product but not the help?Originally Posted by IVY440
Match looks in an array for a particular value, and returns its index within that array if found.Originally Posted by IVY440
So, yes, Match will do it fine.
Something like
Dim iPos As Long Dim myVal myVal = "some lookup value" On Error Resume Next iPos = Application.Match(myVal, Range("A1:A20"), 0) On Error GoTo 0 If iPos > 0 Then MsgBox "found" Else MsgBox "not found" End If
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber