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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
MsgBox WorksheetFunction.WeekNum([B2], 2)
 
Upvote 0
Please show a before and after sample of your worksheet. Only a couple of lines is needed.
 
Upvote 0
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
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
=WEEKNUM(B2) As a sheet function
 
Upvote 0

Forum statistics

Threads
1,214,785
Messages
6,121,543
Members
449,038
Latest member
Guest1337

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
Back
Top