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

Share:
10,856
r00tAcc3ss
Author by

r00tAcc3ss

Updated on June 04, 2022

Comments

  • r00tAcc3ss
    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
    r00tAcc3ss about 9 years
    Thank 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
    Yinda Yin about 9 years
    So is WorksheetFunction.Find just a variation on InStr()? Why not just use InStr(), a function which everyone understands?
  • r00tAcc3ss
    r00tAcc3ss about 9 years
    What would happen if 'a' doesn't exist in PERMITTED?