假期牌友出了点小事,没牌打了,太热了不想出门
想着还有个问题没解决,试验了一下,应该没错误,完了做个记录
'=======================================
'客户加一个结账时间区分字段,对应ENDDAY
Public Function MonthlyByDate(Ddate As Date, Optional EndDay As Integer = 25) '默认25日
On Error Resume Next
If EndDay = 31 Then '把31当成正常月底统计
MonthlyByDate = DateSerial(Year(Ddate), Month(Ddate), 1)
Else
If Day(Ddate) > EndDay Then
MonthlyByDate = DateSerial(Year(Ddate), Month(Ddate) + 1, 1)
Else
MonthlyByDate = DateSerial(Year(Ddate), Month(Ddate), 1)
End If
End If
End Function
'=======================================