我需要在VBA中执行优化。我想把它作为功能的一部分。我该怎么办?
这是我的功能:
//Wait for the page to finish loading (all resources will have been loaded, rendering is likely still happening)
chromeBrowser.LoadingStateChanged += (sender, args) =>
{
//Wait for the Page to finish loading
if (args.IsLoading == false)
{
string script = string.Format("javascript code");
chromeBrowser.EvaluateScriptAsync(script);
}
};
我想获取Function TirNoPer360(Cash, Dates As Range)
Dim i, n As Integer
Dim sum, rate, tolerance As Double
Dim Inicio As Date
Dim rate as Variant
tolerance = 0.00001
Initial = Dates(1, 1)
sum = 0
For i = 1 To Cash.Rows.Count
sum = sum + Cash(i) / ((1 + rate) ^ (Application.WorksheetFunction.Days360(Initial, Dates(i)) / 360))
Next i
TirNoPer360 = sum
End Function
的值(使用根查找算法),那就是rate
。
作为该功能的一部分,我该如何做?任何指导都是有益的