I keep getting an overflow on the following code when it attempts to run the dateAdd function. I've looked through the excel help and I can't figure out what I'm doing wrong. I know it's probably something easy, but a fresh set of eyes would be appreciated.
Sub SetDate()
Dim currentDay As Date
Dim dayOfWeek, statusDay As Integer
currentDay = Now
dayOfWeek = DateDiff("d", "8/26/2013", currentDay) Mod 7
Select Case dayOfWeek
Case 0
statusDay = currentDay
Case 1
statusDay = DateAdd("d", -1, currentDay)
Case 2
statusDay = DateAdd("d", -2, currentDay)
Case 3
statusDay = DateAdd("d", -3, currentDay)
Case 4
statusDay = DateAdd("d", -4, currentDay)
Case 5
statusDay = DateAdd("d", -5, currentDay)
Case 6
statusDay = DateAdd("d", -6, currentDay)
End Select
End Sub
Bookmarks