G
Guest
Hi! I have a loop in which I sometimes add to a variable. I check if a date
is a saturday, if yes then I check if it the day following that (ie the
sunday) is the last day of the month. if it is the last day of the month then
I add 1 to the variable datDate and if it is not the last day of the month
then I add 2. This works fine in the loop but once the code goes to the
MsgBox then datDate has the same value as before. Please help me solve this!
Thanks alot!
If Weekday(datDate) = 7 Then 'saturday
If Month(datDate) = Month(datDate + 1) Then
If Month(datDate + 1) <> Month(datDate + 2) Then
datDate = datDate + 1 'jump to
sunday since last day of month
Else
datDate = datDate + 2 'jump to
monday
End If
End If
End If
MsgBox strDate
is a saturday, if yes then I check if it the day following that (ie the
sunday) is the last day of the month. if it is the last day of the month then
I add 1 to the variable datDate and if it is not the last day of the month
then I add 2. This works fine in the loop but once the code goes to the
MsgBox then datDate has the same value as before. Please help me solve this!
Thanks alot!
If Weekday(datDate) = 7 Then 'saturday
If Month(datDate) = Month(datDate + 1) Then
If Month(datDate + 1) <> Month(datDate + 2) Then
datDate = datDate + 1 'jump to
sunday since last day of month
Else
datDate = datDate + 2 'jump to
monday
End If
End If
End If
MsgBox strDate