Convert date to weeknumber (VBA)

Mortenkamstrup

New Member
Joined
Nov 5, 2016
Messages
26
Dear all
How do i convert a date to a week number?

It is in VBA and the week number does already exists in cell B2 (I do not want the Date to stay anywhere only the week number)

Any help or any idea which to try will be highly appreciated :)
Thanks in advance
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.

Sektor

Well-known Member
Joined
May 6, 2011
Messages
2,874
Office Version
  1. 365
Platform
  1. Windows
MsgBox WorksheetFunction.WeekNum([B2], 2)
 
Upvote 0

alansidman

Well-known Member
Joined
Feb 26, 2007
Messages
7,595
Office Version
  1. 365
Platform
  1. Windows
Please show a before and after sample of your worksheet. Only a couple of lines is needed.
 
Upvote 0

Mortenkamstrup

New Member
Joined
Nov 5, 2016
Messages
26
Sub Convert()


Dim ugenr As Date
Range("B2").Select

End Sub


'the date is allready written in cell B2 but have to be convertet to a weeknumber without the date staying anywhere in the sheet.
'i am doin this converting multiple time so the formel should be with ect. activecell.convert
'Ugenr is the date which is copied in multiple times and afterwards have to be convertet
 
Last edited:
Upvote 0

Mortenkamstrup

New Member
Joined
Nov 5, 2016
Messages
26
I have found a solution where i just can have the date in 1 side and the week number in another side of the template so need to worry :)

But thanks alot for the time and effort to every1 who spend time to trying helping me :)
 
Upvote 0

mole999

Well-known Member
Joined
Oct 23, 2004
Messages
10,524
Office Version
  1. 2019
  2. 2016
  3. 2013
Platform
  1. Windows
=WEEKNUM(B2) As a sheet function
 
Upvote 0

Forum statistics

Threads
1,196,027
Messages
6,012,948
Members
441,740
Latest member
abaz21

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top