View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] rdidentity@gmail.com is offline
external usenet poster
 
Posts: 12
Default macro with SUMPRODUCT help

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