View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
DogLover DogLover is offline
external usenet poster
 
Posts: 37
Default Sumproduct in VBA Type Mismatch problem

Just wanting to count multiple criteria and plan to expand this function once
I know it is error free. I think I have some format off or something, please
help I get the message "type mismatch".

mquestion1range has numerical data which should sum if the mTimeCriteria is
found to match.

Dim mTimeCriteria, mPositionCriteria As String
Dim mQuestion1Range, mTimeRange, mPositionRange As Range
Dim mFormula As String
Dim mCount As Long

mTimeCriteria = "First day of employment (Time 1)"
mPositionCriteria = "Registered Nurse"
Set mPositionRange = Worksheets("Data").Range("DataPosition")
Set mTimeRange = Worksheets("Data").Range("DataTime")
Set mQuestion1Range = Worksheets("Data").Range("DataQuestion1")J

MsgBox Evaluate("=SUMPRODUCT( --(mTimeRange= " & mTimeCriteria &
")*(mQuestion1Range) )")