using worksheet functions in code
If the worksheet function is available, it's better to use
application.worksheetfunction.functionname (or application.functionname), but if
the function is not available, you can use Evaluate.
I looked at the help for Price and did this in code:
Option Explicit
Sub testme()
Dim myFormula As String
myFormula = "price(" & CLng(DateSerial(2008, 2, 15)) & "," & _
CLng(DateSerial(2017, 11, 17)) & "," & _
"0.0575,0.065,100,2,0)"
MsgBox Application.Evaluate(myFormula)
End Sub
I got the same answer as the help showed.
mike allen wrote:
can i access, in vba, all functions that excel uses on their spreadsheets?
i am looking to use 'yield' and 'price' functions in vba. thanks
--
Dave Peterson
|