• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Save file with previous week number

I am trying to save my dashboard report with previous week number. I tried with multiple ways but could not get it with month's week number.

Can I save a file with Previous Week number of Month with Month - Year like "Week 3 - Feb - 2018"
 
Niranjanrajrishi
There are many kind of weeks, here is one sample:
Code:
MsgBox "Week " & Format(Date - 7, "ww", vbMonday, vbFirstFourDays) & " - " & Format(Date - 7, "mmm - yyyy")
 
Thank you.

I would require to save my workfile with previous week number of the month. let's say I want to save my file last week's number (Monday to Sunday) and it should be Week 4 - Feb - 2018.

Is your coding it says Week 7. I hope you have considered the week of the year. Can you help with the code to save the file as the requirement mentioned?
 
Niranjanrajrishi
You asked: I am trying to save my dashboard report with previous week number.
Did You ask what You wanted or something else?
For me, now is Week: 8, Day: 25, Month: April and Year: 2018.
My solution give week 7 and so on.
Hope? I know only possibilities.
As I tried to write
... There are many kind of weeks in the world.
 
I get your point and the way your code gives the data.

I was trying to get the Week number of the month. I want to get only the Week number of Month. Let's say Feb'18 has 4 weeks and trying to save the dashboard of 3rd week of Feb'18.

Every Monday I need to save the Dashboard of the last week. If this does not work, I will go with your coding.
 
Niranjanrajrishi
You wrote something ...
Do You think same that You wrote?
You wrote that You would like to get something like: "Week 3 - Feb - 2018"
Now, You wrote I want to get only the Week number of Month.
What would that be?
For me, below is this February, 2018.
For me, there are five weeks - for You ... four?
Screen Shot 2018-02-25 at 19.43.21.png
Every Monday I need to save the Dashboard of the last week.
For me, next day will be Monday (26)
... You'll save week 8 file ...
or
What would Your term 'Week' mean?

Ps. One thing about Your filename ... is it useful?
 
Thank you for the correction. Yes the week count is 5.

So If I want to save the file with with Week number 4, how would I adjust the coding?

Our week day ends on Friday; hence the file name should be "Week 4 - Feb - 2018.

Does it possible to save the file name? Sorry if I have not given the proper info before.
 
If this is so 'clear' for You ...
Would You know few months later - what is what?
Next Monday, You would save file with '20180219-20180225' (= from Monday to Sunday)
Then, You would know what would it mean.
 
Like this:
Code:
d = Date - Weekday(Date, vbMonday)
MsgBox Format(d - 6, "yyyymmdd") & "-" & Format(d, "yyyymmdd")
 
Back
Top