Reputation: 362
I was hoping you'd be able to help me out with a bit of code which calculates the Week Number based from the system date.
I have a TextBox WeekNum
, which I want to show the Week Number for when CommandButton1_Click
is activated.
I have found articles on how to calculate the Week Number from a given date, but I do not know enough VBA to change this to the system date.
Any help you can offer will be appreciated!
Upvotes: 1
Views: 12727
Reputation:
VBA
Debug.Print Format(Now, "ww")
FORMULA
=1+INT((TODAY()-(DATE(YEAR(TODAY()),1,2)-WEEKDAY(DATE(YEAR(TODAY()),1,1))))/7)
Upvotes: 5