What does Application.WorksheetFunction.Find do?
10,856
Consider:
Sub fksdjhfsdjf()
aChar = "a"
PERMITTED = "qwertyasdf"
digit = Application.WorksheetFunction.Find(aChar, PERMITTED)
MsgBox digit
End Sub
FIND() will return the position of "a" ________________similar to InStr()
EDIT#1
Both Application.WorkSheetfunction.Find() and InStr() are case sensitive
If the little string does not exist within the big string, Application.WorkSheetfunction.Find() will raise an error and InStr() will return a 0.
This is not the same as the Range.find() Method
Author by
r00tAcc3ss
Updated on June 04, 2022Comments
-
r00tAcc3ss over 1 year
Trying to convert a vbscript to php.
Have this line in the script:
digit = Application.WorksheetFunction.Find(aChar, PERMITTED)
Where aChar is a character and PERMITTED is a string.
It looks like some sort of validation, but not 100% sure.
What value will digit be? What happends if aChar is not in PERMITTED?
The documentation isn't very clear.
-
r00tAcc3ss about 9 yearsThank you! That answer seems consistent with the context of the argument. What would happen if 'a' doesn't exist in PERMITTED? (edit, clarified question)
-
Yinda Yin about 9 yearsSo is
WorksheetFunction.Find
just a variation onInStr()
? Why not just useInStr()
, a function which everyone understands? -
r00tAcc3ss about 9 yearsWhat would happen if 'a' doesn't exist in PERMITTED?