
VBA WorksheetFunction in Excel — Call Excel's Own Functions from Code (and the Two Ways They Fail)
Application.WorksheetFunction lets VBA borrow Excel's 450-plus built-in functions instead of rewriting SUM, VLOOKUP or COUNTIF as a loop. The catch is that there are two ways to call them and they fail differently. WorksheetFunction.X raises a run-time error when there is no match, while Application.X returns an error value you test with IsError. Learn which call style to use, why the result must be a Variant, which functions you should not call this way, and when to pass a whole range instead of looping cell by cell.





























































