Hello once again everyone,
I've developed this calculation first in sql for a persons ReleaseDate base on good behavior; its something we calculate daily in my line of work, However am now learning vba_functions and have just developed a user function in vba of the same calculations works perfectly. The calculations is base on Years, Months and Weeks in jailtime. As is.... I have three defined functions... seperatley but i want them together as one... could I combine these functions as one Singular Function???. because the function Epd Earliest possible date have different variables to years, months and weeks and days,,, there is aslo another argument if the date falls on a Sunday we release the day before dont know how to plug that varialble in either but as is 99% of the time the code give the right answer this is my vba codes:
Function Epdy(ConDate As Date, intYrs As Integer)
Dim FD As Date, intDays As Integer
Dim re As Date, Remmission As Integer
FD = DateAdd("yyyy", intYrs, ConDate - 1)
intDays = DateDiff("d", ConDate, FD + 1)
Remmission = Round(intDays / 3, 0)
Epdy = (FD - Remmission)
End Function
Function Epdm(ConDate As Date, intMth As Integer)
Dim FD As Date, intDays As Integer
Dim re As Date, Remmission As Integer
FD = DateAdd("m", intMth, ConDate - 1)
intDays = DateDiff("d", ConDate, FD + 1)
Remmission = intDays / 2
Epdm = (FD - Remmission)
End Function
Function Epdys(ConDate As Date, intdys As Integer)
Dim FD As Date, intDays As Integer
Dim re As Date, Remmission As Integer
FD = DateAdd("d", intDays, ConDate)
intDays = DateDiff("d", ConDate, FD)
Remmission = intDays - 30
Epdys = (FD - Remmission)
End Function