ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating date (https://www.excelbanter.com/excel-programming/277135-updating-date.html)

Richard Leclezio

Updating date
 
I am showing you a cross section of some code :

Sub Download_Nostros()
Sheets("Data").Select
ActiveSheet.Unprotect
Range("All_NOSTRO").Select
Selection.ClearContents
Workbooks.Open FileName:= _
"\\my_documents\downloads\P51GRPR-SEP15.xls"
Range("A1:K500").Select
Selection.Copy

How do I automatically update or change "P51GRPR-
SEP15.xls" to the next working day. Any help would be
greatly appreciated.

Richard


Tom Ogilvy

Updating date
 
Dim nDay as Long, sStr as String, fName as String
sStr = "\\my_documents\downloads\P51GRPR"
nday = Choose(weekday(Date),1,1,1,1,1,3,2)
fname = sSTr & ucase(format(date+nday,"MMMDD")) & ".xls"

Workbooks.Open Filename:=fname

--
Regards,
Tom Ogilvy


"Richard Leclezio" wrote in message
...
I am showing you a cross section of some code :

Sub Download_Nostros()
Sheets("Data").Select
ActiveSheet.Unprotect
Range("All_NOSTRO").Select
Selection.ClearContents
Workbooks.Open FileName:= _
"\\my_documents\downloads\P51GRPR-SEP15.xls"
Range("A1:K500").Select
Selection.Copy

How do I automatically update or change "P51GRPR-
SEP15.xls" to the next working day. Any help would be
greatly appreciated.

Richard





All times are GMT +1. The time now is 10:08 PM.

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