Conquistador
Conquistador

Reputation: 362

VBA Week Number from System Date

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

Answers (1)

user2140173
user2140173

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

Related Questions