lundi 29 janvier 2018

If with Weekday & DateAdd

VBA beginner here, apologies if this is a dumb question. I need to save a file as the previous day's date. On Mondays, I need to save the file as Fridays date. Here's what I have:

If FileDate = Weekday(Date, vbMonday) Then Format(DateAdd("d", -3, Date)) = "yyyymmdd" Else FileDate = Format(DateAdd("d", -1, Date), "yyyymmdd")

This is spitting out date-1 even on Mondays. Any ideas how to get this to show Friday's date if run on a Monday? I appreciate the help! Thank you!

Aucun commentaire:

Enregistrer un commentaire