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!
VBA
Debug.Print Format(Now, "ww")
FORMULA
=1+INT((TODAY()-(DATE(YEAR(TODAY()),1,2)-WEEKDAY(DATE(YEAR(TODAY()),1,1))))/7)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.