Skip to content

Instantly share code, notes, and snippets.

@adamancini
Created August 21, 2012 17:47
Show Gist options
  • Save adamancini/3417812 to your computer and use it in GitHub Desktop.
Save adamancini/3417812 to your computer and use it in GitHub Desktop.
'Get the current fiscal year
Function strGetYear() As String
Dim stryear1 As String
Dim stryear2 As String
Dim n As Integer
Dim nn As Integer
Dim nnn As Integer
Dim nnnn As Integer
Dim date1 As Date
Dim date2 As Date
Dim date3 As Date
stryear1 = PRF_strFY - 1 'PRF_strFY is a global variable
stryear2 = PRF_strFY
date1 = strTest_Date 'strTest_Date is a global variable
n = 20
Do Until n = 0
date2 = "06/30/" & stryear1
date3 = "07/01/" & stryear2
If ((date1 > date2) And (date1 < date3)) Then
strGetYear = stryear2
n = 1
End If
n = n - 1
stryear1 = stryear1 - 1
stryear2 = stryear2 - 1
Loop
End Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment