This example marks the user-defined function "My_Func" as volatile. The function will be recalculated whenever calculation occurs in any cells on the worksheet on which this function appears.
Function My_Func()
Application.Volatile
'
' Remainder of the function
'
End Function