I'm trying to write the following SUMIF statement, but the syntax it screwing me up. I'm doing something wrong...
In a For...Next statement:
Cell.Offset(0, 3) = Application.WorksheetFunction.SumIf(AWB.sSh.Range("A8:A" & lastRow), Cell.Value, AWB.sSh.Range("G8:G" & lastRow))
Here's what I'm trying to do:
1. use SUMIF via Application.WorksheetFunction.Sumif()
2. Set the first range to a workbook I have previously defined as "AWB", to a sheet on that workbook that I have previously defined as "sSH", within the range "A8:A" & lastRow), I have previously defined "lastRow"
3. Set the second range to the current Cell.Value in the For statement
4. Set the third range again to AWB.sSH.Range("G8:G" & lastRow)
Logically, I understand what I'm trying to do, but I'm not sure how to make this work in VBA.
Bookmarks