I'm new to vba, I want to know how to implement a formula (sumproduct) on excel to vba. The formula gets value from other sheets on the workbook. The formula is:
=((SUMPRODUCT(-(Details!$C$7:$C$1182=A3),-(Details!$E$7:$E$1182=B3), -(Details!$S$7:$S$1182="Delivered"), -(Details!$G$7:$G$1182=C3), Details!$N$7:$N$1182)))
Here's my code;
Private Sub ATO()
Dim ws1 As Worksheet
Dim wb1 As Workbook
Dim last As Long
Dim i As Integer
Set wb1 = ThisWorkbook
Set ws1 = wb1.Worksheets("Summary")
last = ws1.Cells(Rows.Count, "A").End(xlUp).Row
ws1.Range("I2:I" & last) = Application.SumProduct(?)
End Sub
Is my code on the right track? Any response would be appreciated.