View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default saving with a date

Assuming the holidays are stored in a named range

Dim SaveDate As Date

SaveDate = Date - 1
If Weekday(SaveDate) = 1 Then
SaveDate = SaveDate - 2
ElseIf Weekday(SaveDate) = 7 Then
SaveDate = SaveDate - 1
End If
If Not IsError(Application.Match(Range("holidays"), 0)) Then
SaveDate = SaveDate - 1
End If
ActiveWorkbook.SaveAs Filename:=Format(SaveDate, "yyyy-mm-dd")


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Patricia" wrote in message
...
Could anyone tell me how you can save a file with a date one day before
today's date but if it falls on a holiday to save it with the prior date.
Thank you.
--
Patricia