DogLover;564261 Wrote:
How would you rewrite this to use
Application.Worksheetfunction.Sumproduct??
With difficulty. I'll withdraw the suggestion and I'm with Joe User on
this one.
Sticking with Evaluate you could simplify the code by not having to set
variables to ranges by using the existing names directly in the formula,
as you would on the sheet:
MsgBox Evaluate("=SUMPRODUCT(--(DataTime=""" &
mTimeCriteria & """)*DataQuestion1)")
So after removing everything extraneous to the evaluate line all you
need is:
Dim mTimeCriteria As String
mTimeCriteria = "First day of employment (Time 1)"
MsgBox Evaluate("=SUMPRODUCT(--(DataTime=""" & mTimeCriteria &
""")*DataQuestion1)")
--
p45cal
*p45cal*
------------------------------------------------------------------------
p45cal's Profile:
http://www.thecodecage.com/forumz/member.php?userid=558
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=155665
Microsoft Office Help