M
mienz
Hi
I want to write a reuseable maxif function in vba. The following cod
is working when entered directly into the cell:
=SUMPRODUCT(MAX((B1:B6=B2) * (A1:A6)))
Now I want to pack this function into vba code to make it commonl
available. I tried it with the following code but it doesn't work.
assume there is a problem with the passing of the range parameters.
also tried it with String and Variant as parameter types - withou
success. Can anybody help me?
Public Function MaxIF(criteriaRange As Range, searchValue As Variant
calcRange As Range)
AciveCell.Formula = "=SumProduct(Max((criteriaRange = searchValue
* (calcRange)))"
End Functio
I want to write a reuseable maxif function in vba. The following cod
is working when entered directly into the cell:
=SUMPRODUCT(MAX((B1:B6=B2) * (A1:A6)))
Now I want to pack this function into vba code to make it commonl
available. I tried it with the following code but it doesn't work.
assume there is a problem with the passing of the range parameters.
also tried it with String and Variant as parameter types - withou
success. Can anybody help me?
Public Function MaxIF(criteriaRange As Range, searchValue As Variant
calcRange As Range)
AciveCell.Formula = "=SumProduct(Max((criteriaRange = searchValue
* (calcRange)))"
End Functio