Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 18
Default VBA to find next Monday

What is the best way to find the date for next monday, and return the value
in as part of the file name when saving?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA to find next Monday


Hello Byron,

Here is a VBA macro to Return the next Monday from today.


Code:
--------------------

Public Function NextMonday() As Date

Dim D As Integer
Dim N As Date

D = Weekday(Now)
N = Now() + (9 - D)

NextMonday = N

End Function

--------------------

Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=484594

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default VBA to find next Monday

I'm not sure just how you wanted to incorporate the date into the file name
for the saved workbook but something like this might get you close.

Sub NameAsNextMon()
Dim K As Integer
Dim dteMon As Date
Dim tempName As Variant

K = Weekday(Now)
dteMon = Now() + (9 - K)
tempName = Year(dteMon) & "-" & Month(dteMon) & "-" & Day(dteMon) & ".xls"
Do
fName = Application.GetSaveAsFilename(tempName)
Loop Until fName < False
ActiveWorkbook.SaveAs Filename:=fName
End Sub


Steve Yandl


"Byron" wrote in message
...
What is the best way to find the date for next monday, and return the
value
in as part of the file name when saving?




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
First Monday Charlie O'Neill Excel Discussion (Misc queries) 8 April 15th 10 06:09 PM
Find date of first Monday of each month Ian R Excel Discussion (Misc queries) 7 June 29th 08 08:58 PM
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
Find First Monday in May Sandy Excel Worksheet Functions 2 March 9th 06 07:18 PM
Find the date for monday prior to May 25th Ralph Heidecke Excel Worksheet Functions 1 January 5th 06 12:30 AM


All times are GMT +1. The time now is 09:29 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"