I want to get the date of Monday for each week. I am using that date to open a folder that is created every Monday and is named based on the date. I tried using weekday() function. But I am not sure how to proceed. Thanks for the help! This is what i have tried, it works. But I juts wanted to know if there is more efficient way to do it?
Sub test()
Dim myday As Integer
Dim mydate As Date
mydate = Date
myday = Weekday(Date, vbMonday)
If myday = 1 Then
mydate = Date
ElseIf myday = 2 Then
mydate = DateAdd("d", -1, Date)
ElseIf myday = 3 Then
mydate = DateAdd("d", -2, Date)
ElseIf myday = 4 Then
mydate = DateAdd("d", -3, Date)
ElseIf myday = 5 Then
mydate = DateAdd("d", -4, Date)
End If
End Sub