我想找到每个月使用循环的总和,但我很难找到一个代码,将30天和30个月与31天区分开来?
我目前的代码如下,有人可以帮帮我吗?
`Sub MonthlyPeak()
Dim Peak As Range, p As Double, i As Integer, r As Integer
For r = 4 To 26404 **Step 672**
For i = 9 To 231
Set Peak = Worksheets("coa_20150409").Range(Cells(r, i), Cells(r + 671, i))
p = Application.WorksheetFunction.Max(Peak)
Worksheets("MonthlyPeak").Cells(r, i).Value = p
Next i
Next r
End Sub`
步骤672指的是假设24小时7天的每月计算的小时数据,但这并不能说明每个月的天数差异。