Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default 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.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 661
Default 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.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 523
Default 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.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default 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.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
a formula that returns the previous fridays date diggyroo Excel Worksheet Functions 7 March 13th 08 01:59 AM
Date calculation for Monday of one month to the Monday of the next Sunnyskies Excel Discussion (Misc queries) 19 July 2nd 07 12:08 PM
formula for last Fridays date Pete Excel Discussion (Misc queries) 6 February 20th 07 06:18 PM
show fridays Tanner Excel Worksheet Functions 2 March 27th 06 02:43 AM
Auto_Open() How to show prior Monday? Jeff Excel Discussion (Misc queries) 3 March 19th 05 11:41 PM


All times are GMT +1. The time now is 12:33 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"