G
Guest
Sub rework()
Dim ans As Variant
Dim ans2 As Variant
Dim var As Variant
ans = InputBox("Which advisor do you wish to use?")
ans2 = InputBox("Which payment method do you wish to use?")
var = WorksheetFunction.SumProduct(--(Range("A1:A10000") = ans),
--(Range("H1:H10000") = ans2))
MsgBox (var & " cases match your criteria.")
End Sub
I'm trying to work out how to use WorksheetFunction so I can make some
macro's that can calculate data without having to enter the formulas into the
spreadsheet. I tried off with .Index and got that to work quite easily, but
..SumProduct would be the most useful for me but i'm unsure how to make them
different to than if I was typing the formula into a cell...
Dim ans As Variant
Dim ans2 As Variant
Dim var As Variant
ans = InputBox("Which advisor do you wish to use?")
ans2 = InputBox("Which payment method do you wish to use?")
var = WorksheetFunction.SumProduct(--(Range("A1:A10000") = ans),
--(Range("H1:H10000") = ans2))
MsgBox (var & " cases match your criteria.")
End Sub
I'm trying to work out how to use WorksheetFunction so I can make some
macro's that can calculate data without having to enter the formulas into the
spreadsheet. I tried off with .Index and got that to work quite easily, but
..SumProduct would be the most useful for me but i'm unsure how to make them
different to than if I was typing the formula into a cell...