Moderator Notice...
Here we go again cycle number 3 , slightly different strategy, posting almost the same question in a few cross posts, then juggling around , passing given macros from one place to the other to give the impression of having done something himself.....
https://chandoo.org/forum/threads/if...9/#post-266341
https://eileenslounge.com/viewtopic.php?f=30&t=34937
https://eileenslounge.com/viewtopic.php?f=30&t=34936
https://www.excelforum.com/excel-pro...o-nothing.html https://excelfox.com/forum/showthrea...ll=1#post13495
Hi
I am not sure if I understand exactly what you want.
If Application.Match does not find a match, then the code line does not error, instead it returns an error string.
We can use IsError( ) to tell us if an error string has been returned. This will be True if an error string is detected in the ( )
Possibly you want this
If that is not what you want, then provide a file or files to show me what you wantCode:Let MtchRes = Application.Match(arrWs1(Cnt, 9), ClmB(), 0) If IsError(MtchRes) Then ' No match was found Let arrS1(Cnt, 10) = "delete word" Else ' A match was found If arrWsA4(MtchRes, 4) = ">" Then Let arrS1(Cnt, 10) = "SHORT" ElseIf arrWsA4(MtchRes, 4) = "<" Then Let arrS1(Cnt, 10) = "BUY" Else End If End If
Alan
P.S:
IsError( ) does not tell you if a code line has eroded. If a code line errors, then the macro will stop and you will get an error pop up to tell you about the error.
Application.Match will return either
_ a number telling you the position along where it finds in the second argument what you have in the first argument ( Application.Match( First argument , second argument , 0 ) In other words it returns you the position along of the match
or
_ an error string if it does not find a match
Note also:
WorksheetFunction.Match works a bit differently. If it does not find a match then it will error. I expect your next 50 duplicated cross posted questions will come when a macro you have with that in does not work….
.... Edit: For example didn't take long... https://eileenslounge.com/viewtopic....271335#p271335
Bookmarks