以下内容如何:
Sub foo()
Dim ws As Worksheet: Set ws = Sheets("Sheet1")
'declare and set your worksheet, amend as required
LastRow = ws.Cells(ws.Rows.Count, "A").End(xlUp).Row
'get the last row with data on Column A
For i = 1 To LastRow
aValue = ws.Cells(i, 1) 'get values from first row
bValue = ws.Cells(i, 2)
cValue = ws.Cells(i, 3)
If aValue = ws.Cells(i + 1, 1) And bValue = ws.Cells(i + 1, 2) Then 'compare to next row
If cValue + ws.Cells(i + 1, 3) = O Then 'if adding values from Column C = 0 then
ws.Cells(i, 3) = 0 'write 0 in both rows
ws.Cells(i + 1, 3) = 0
End If
End If
Next i
End Sub