indi visual
Member
Having problems getting the following code to get the next bi-weekly payday date.
The paydays are every other Friday, and because the next bi-weekly payday is this week (6/14), the code should return the value date of 6/14/13 (in whatever format as long as the date is essentially 6/14).
When it's Friday, the code should return the next payday Friday which would be 6/28 etc..
The code I'm using beneath is all I could find that wasn't an excel formula.
It returns the 6/14 but fails to return the subsequent accurate dates.
I found an abundance of formulas that do the job with ease, but I'll need to implement this into code so "I think" I won't be able to use formulas if I'm on the code side.
Any help is definitely appreciated!
[pre]
[/pre]
The paydays are every other Friday, and because the next bi-weekly payday is this week (6/14), the code should return the value date of 6/14/13 (in whatever format as long as the date is essentially 6/14).
When it's Friday, the code should return the next payday Friday which would be 6/28 etc..
The code I'm using beneath is all I could find that wasn't an excel formula.
It returns the 6/14 but fails to return the subsequent accurate dates.
I found an abundance of formulas that do the job with ease, but I'll need to implement this into code so "I think" I won't be able to use formulas if I'm on the code side.
Any help is definitely appreciated!
[pre]
Code:
<br />
Dim NextPayDayDate As Date<br />
NextPayDayDate = DateAdd("d", 0, Date) + (8 - Weekday(Date, vbFriday))<br />
MsgBox NextPayDayDate<br />