The following script is to find the following saturday date or if the last day of the month falls on the week.
' This test is using array to store the dates & compare if last day of the month falls on the week, if not it will display the following 'Saturday date'
Dim DateArray(6)
TodaysDate = Date
TodaysDay = WeekDay(TodaysDate)
For Counter = 0 To 6
If TodaysDay < 8 Then
DateArray(Counter) = TodaysDate
TodaysDate = TodaysDate + 1
End If
TodaysDay = TodaysDay + 1
Next
LastDay = DateArray(0)
For j = 1 to 6
If LastDay < DateArray(j) Then
LastDay = DateArray(j)
End If
Next
Msgbox LastDay
' This test is using array to store the dates & compare if last day of the month falls on the week, if not it will display the following 'Saturday date'
Dim DateArray(6)
TodaysDate = Date
TodaysDay = WeekDay(TodaysDate)
For Counter = 0 To 6
If TodaysDay < 8 Then
DateArray(Counter) = TodaysDate
TodaysDate = TodaysDate + 1
End If
TodaysDay = TodaysDay + 1
Next
LastDay = DateArray(0)
For j = 1 to 6
If LastDay < DateArray(j) Then
LastDay = DateArray(j)
End If
Next
Msgbox LastDay
No comments:
Post a Comment