I forgot to mention i use excel 2002. But I would guess this function is available to this version anyways.
i've tryed a few things, and it keeps sending the same msg.
Sub Macro1()
Dim LR As Integer
Dim rw As Integer
Dim RSum As Integer
LR = Range("C" & Rows.Count).End(xlUp).Row
RSum = Range("n" & Rows.Count).End(xlUp).Row
For rw = 2 To LR
If Not IsEmpty(Range("C" & rw).Value) Then
'Range("G & rw").Formula = "=somase(("N2:N60"),("C"&rw), ("S2:S"&RSum))
Range("G" & rw).Value = Application.WorksheetFunction.SumIfs(Range("N2:N" & RSum), Range("C" & rw), Range("S2:S" & RSum))
End If
If Range("G" & rw).Value = 0 Then
Range("G" & rw).Value = "-"
Range("F" & rw).Value = "Não"
ElseIf Range("G" & rw).Value <> 0 Then
Range("F" & rw).Value = "Sim"
End If
Next rw
End Sub
Bookmarks