I would like to use worksheetfunction max with multiple criteria in excel VBA. I have the following data:
<colgroup><col width="44"><col width="44"></colgroup> <tbody>
</tbody>
In excel i was able to use the formula =MAX(($A$2:$A$6=$A2)*($B$2:$B$6)). I would like to be able to do the same in VBA using the worksheetfunction.max. I was trying something like
worksheetfunction.MAX(($A$2:$A$6=$A2)*($B$2:$B$6)) and it didnt work. Any suggestions on these line on how to proceed?
Thanks.
<colgroup><col width="86"><col width="86"></colgroup> <tbody>
</tbody>
Col A | Col B |
a | 1 |
a | 2 |
a | 3 |
b | 4 |
b | 5 |
<colgroup><col width="44"><col width="44"></colgroup> <tbody>
</tbody>
In excel i was able to use the formula =MAX(($A$2:$A$6=$A2)*($B$2:$B$6)). I would like to be able to do the same in VBA using the worksheetfunction.max. I was trying something like
worksheetfunction.MAX(($A$2:$A$6=$A2)*($B$2:$B$6)) and it didnt work. Any suggestions on these line on how to proceed?
Thanks.
<colgroup><col width="44"><col width="44"></colgroup> <tbody> </tbody> | |||||||||||||
<colgroup><col width="86"><col width="86"></colgroup> <tbody>
</tbody>