ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Show Fridays date on monday (https://www.excelbanter.com/excel-programming/435850-show-fridays-date-monday.html)

John

Show Fridays date on monday
 
I have a VB code that will stamp the previous days date in the subject of an
e-mail. But on Monday I need it to post Friday's date. How can I do this?

Here is the code that I currently have.

..Subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")

Thank you for your help.


Paul

Show Fridays date on monday
 
John

Do you really want Friday to be the hard-coded day or are you after the
previous working day ?



"John" wrote:

I have a VB code that will stamp the previous days date in the subject of an
e-mail. But on Monday I need it to post Friday's date. How can I do this?

Here is the code that I currently have.

.Subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")

Thank you for your help.


Sam Wilson

Show Fridays date on monday
 
if day(now) = 2 then
.subject = "PKG Results - " & Format(Now() - 3, "dddd, mmmm dd,yyyy")
else
.subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")
end if


"John" wrote:

I have a VB code that will stamp the previous days date in the subject of an
e-mail. But on Monday I need it to post Friday's date. How can I do this?

Here is the code that I currently have.

.Subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")

Thank you for your help.


Mike H

Show Fridays date on monday
 
John,

Try this

If Weekday(Now) = 2 Then
Mydate = Now - 3
Else
Mydate = Now - 1
End If
..Subject = "PKG Results - " & Format(Mydate, "dddd, mmmm dd,yyyy")

Mike

"John" wrote:

I have a VB code that will stamp the previous days date in the subject of an
e-mail. But on Monday I need it to post Friday's date. How can I do this?

Here is the code that I currently have.

.Subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")

Thank you for your help.


Rick Rothstein

Show Fridays date on monday
 
Try it this way...

..Subject = "PKG Results - " & Format(Now - 1 + 2 * (Weekday(Now) = 2), "dddd, mmmm dd,yyyy")

--
Rick (MVP - Excel)


"John" wrote in message ...
I have a VB code that will stamp the previous days date in the subject of an
e-mail. But on Monday I need it to post Friday's date. How can I do this?

Here is the code that I currently have.

.Subject = "PKG Results - " & Format(Now() - 1, "dddd, mmmm dd,yyyy")

Thank you for your help.



All times are GMT +1. The time now is 09:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com