Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
function "sumproduct" in VBA environment
Dear Sir / Madam,
Could anyone can help to translate the worksheet function sumproduct (as below) into VBA?? =SUMPRODUCT(--(yard="BSHKY"),--(ac_name="Yard Trucks"),amt) Remark : Yard, ac_name & amt are pre-defined range. My working as follow : (but run-time error 13 type mismatch appear) Sub sp() a = InputBox("Yard") b = InputBox("A/C name") MyAns = Application.WorksheetFunction.SumProduct((Range("y ard") = "a"), (Range("ac_name") = "b"), Range("amt")) End Sub !!!Thank you so much!!! Best rgds // aw -- aw |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
function "sumproduct" in VBA environment
Hello
If your sumproduct formula works, use Evaluate: MyAns = Evaluate("=SUMPRODUCT(--(yard="BSHKY"),--(ac_name="Yard Trucks"),amt)") HTH Cordially Pascal "aw" a crit dans le message de news: ... Dear Sir / Madam, Could anyone can help to translate the worksheet function - "sumproduct" (as below) into VBA?? =SUMPRODUCT(--(yard="BSHKY"),--(ac_name="Yard Trucks"),amt) Remark : "Yard", "ac_name" & "amt" are pre-defined range. My working as follow : (but run-time error '13' type mismatch appear) Sub sp() a = InputBox("Yard") b = InputBox("A/C name") MyAns = Application.WorksheetFunction.SumProduct((Range("y ard") = "a"), (Range("ac_name") = "b"), Range("amt")) End Sub !!!Thank you so much!!! Best rgds // aw -- aw |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Text "comparison" operator for "contains" used in an "IF" Function | Excel Worksheet Functions | |||
nesting "and" in sumproduct function | Excel Discussion (Misc queries) | |||
nesting "and" in sumproduct function | Excel Discussion (Misc queries) | |||
Please add a "sheet" function like "row" and "column" functions | Excel Programming | |||
Set Focus in "Form" environment | Excel Programming |