Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 -- mien ----------------------------------------------------------------------- mienz's Profile: http://www.excelforum.com/member.php...fo&userid=1630 View this thread: http://www.excelforum.com/showthread.php?threadid=27697 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Maxif | Excel Discussion (Misc queries) | |||
MAXIF style function | Excel Worksheet Functions | |||
Looking for the equivalent of a Maxif function | Excel Discussion (Misc queries) | |||
"MAXIF" Equivalent function in Excel | Excel Worksheet Functions | |||
maxif | Excel Worksheet Functions |