Excel VBA Function

Using Excel VBA Functions allows you to use most of the excel worksheet functions in your excel vba macros. For example, you can use the excel functions such as sum, count, countif, countblank, frequency, min, max, weekday and many other excel worksheet functions with excel vba.

There are two main approaches to use excel functions in your excel vba code. You can use excel vba functions to perform calculations by your code and use the results for other excel functions or show the results in your excel workbook. The second approach to use excel vba functions is to create excel formula in a cell in your excel worksheet.

Excel VBA Macro Example: Using the Excel Max Function

This simple excel macro shows you how you can use the excel Max function in your excel vba code. This excel macro looks for the maximum value in the range B2:B13 and shows the maximum value in a message box.

Related: Excel

Sub Using_Excel_Max_Function()

       MaxResult = Application.WorksheetFunction.Max(Range(“B2:B13”))

       MsgBox “The Maximum Value is ” & MaxResult

End Sub