|
发表于 2022-3-2 14:58
|
显示全部楼层
本楼为最佳答案
- Sub 条件格式求和()
- Dim i As Integer, h As Integer, sum As Double
- h = ActiveSheet.Cells(Rows.Count, 4).End(xlUp).Row
- For i = 7 To h
- If ActiveSheet.Cells(i, 5).Value - Application.WorksheetFunction.RoundDown(VBA.CSng(Now), 0) > 0 Then
- sum = sum + ActiveSheet.Cells(i, 4).Value
- End If
- Next i
- ActiveSheet.Cells(5, "g").Value = sum
- End Sub
复制代码
|
|