T
Tommy Brown
I am using many macro functions
But it seems that they are quite slower than the built-in functions
For example, the macro I wrote as below is very similar with the built-in function SUMPRODUCT(), but the speed is very different
I guess, the reason may be due to the fact that the built-in functions exist as binary codes or as a part of the EXCEL program, while macro functions should be interpreted line-by-line all the time the macro functions run
If so, is there any way to make macro functions as a par of excel
--------------------------------------------------------------------------------------------------
Public Function MySumProduct(targets As Range, weights As Range) As Doubl
n = targets.Rows.Coun
MySumProduct =
For i = 1 To
If Application.WorksheetFunction.IsNumber(targets(i, 1)) And
Application.WorksheetFunction.IsNumber(weights(i, 1)) The
MySumProduct = MySumProduct + targets(i, 1).Value * weights(i, 1).Valu
Els
MySumProduct = MySumProduc
End I
Next
End Function
But it seems that they are quite slower than the built-in functions
For example, the macro I wrote as below is very similar with the built-in function SUMPRODUCT(), but the speed is very different
I guess, the reason may be due to the fact that the built-in functions exist as binary codes or as a part of the EXCEL program, while macro functions should be interpreted line-by-line all the time the macro functions run
If so, is there any way to make macro functions as a par of excel
--------------------------------------------------------------------------------------------------
Public Function MySumProduct(targets As Range, weights As Range) As Doubl
n = targets.Rows.Coun
MySumProduct =
For i = 1 To
If Application.WorksheetFunction.IsNumber(targets(i, 1)) And
Application.WorksheetFunction.IsNumber(weights(i, 1)) The
MySumProduct = MySumProduct + targets(i, 1).Value * weights(i, 1).Valu
Els
MySumProduct = MySumProduc
End I
Next
End Function