Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Option Explicit
Private Function Quarter(ByVal Value As Date) As Long
'Combine year and quarter to permit easy comparisons
'(though not arithmetic):
Quarter = DatePart("yyyy", Value) * 10 + DatePart("q", Value)
End Function
Private Function NextQuarterBegins(ByVal Value As Date) As Date
NextQuarterBegins = DateSerial(Year(Value), _
(((DatePart("m", Value) - 1) \ 3) + 1) * 3 + 1, _
1)
End Function
Private Sub Form_Load()
Dim TestDate As Date
TestDate = "May-10-2015"
Text1.Text = "TestDate is " & Format$(TestDate, "mmm-dd-yyyy") & vbNewLine _
& "Quarter(TestDate) is " & CStr(Quarter(TestDate)) & vbNewLine _
& "Quarter(""Jul-01-2015"") is " _
& CStr(Quarter("Jul-01-2015")) & vbNewLine _
& "NextQuarterBegins(TestDate) is " _
& Format$(NextQuarterBegins(TestDate), "mmm-dd-yyyy")
End Sub
TestDate is May-10-2015
Quarter(TestDate) is 20152
Quarter("Jul-01-2015") is 20153
NextQuarterBegins(TestDate) is Jul-01-2015