macro with SUMPRODUCT help
Write the formula that works when entered in the worksheet and perhaps we
can help.
You code as written looks like it is trying to multiply two sentences or a
sentence and a word together.
In any event, your subject says sumproduct, but you are using sum. I
suspect you want to use either as an array formula - which isn't supported
by using WorksheetFunction. If you post the formula that works when entered
in the spreadsheet, someone can show you how to code it. Include what sheet
each range is on.
Another option would be
Sheets("Summary").Range("I7").FormulaArray = "=formula that works"
--
Regards,
Tom Ogilvy
wrote in message
oups.com...
hello
i am working on my project, that will count amount of entries from one
sheet by two criterias, and will insert that amount into another sheet,
and i have no idea what is wrong with this funtion that i wrote, it is
giving me an error everytime ("type mismatch")
here is my funtion
Sub countViolations()
Sheets("Summary").Select
Range("A7").Select
If ActiveCell = "" Then
Exit Sub
Else
Dim nameOfOffender As String
Dim VCount As Long
Dim nameOfViolation As String
nameOfViolation = "Offender Missed Call (STaR)"
nameOfOffender = Range("A7")
Sheets("Details").Activate
VCount = Application.WorksheetFunction.Sum((nameOfOffender) *
(nameOfViolation))
Sheets("Summary").Range("I7") = VCount
End If
End Sub
i am very new at this, it is my second day dealing with VBA, so if
something or everything is extremely wrong with this function please
dont laught :) thx
|