公司对供应商考核和统计工作均是截止到25日的,看了网上很多帖子,各有各的好,在论坛混迹日子较久,没有贡献,现将原创方法放上来大家批评指正。
方法为建立公共函数:
Public Function jidu(日期 As Date) As String
Dim 月 As Double
月 = Format(日期, "mm")
If 月 = 6 or 月 = 9 Then
日期 = 日期 + 5
ElseIf 月 = 3 or 月 = 12 Then
日期 = 日期 + 6
End If
jidu = Format(日期, "yyyy") & "年" & Format(日期, "q") & "季度"
End Function
同时引发另外一个问题,当选择了某个季度后,自动生成起始日期,方法为
建立更新后事件:
Private Sub Combo4_AfterUpdate()
Dim 季度 As Double
Dim 年 As Double
年 = Left(Combo4, 4)
季度 = Left(Right(Combo4, 3), 1)
Select Case 季度
Case 1
Text6 = 年 - 1 & "-12-26"
Text8 = 年 & "-3-25"
Case 2
Text6 = 年 & "-3-26"
Text8 = 年 & "-6-25"
Case 3
Text6 = 年 & "-6-26"
Text8 = 年 & "-9-25"
Case 4
Text6 = 年 & "-9-26"
Text8 = 年 + 1 & "-12-25"
End Select
End Sub
附 件:
25日结算日期示例下载