ukdane
09-24-2009, 10:33 AM
I found this formula elsewhere in the forum (thanks xld!)
=INT((A2- DATE(YEAR(A2),1,0)+6)/7)
where A2 is a cell containing todays date.
However, I want to use this formula in VBA to generate the same result, but attach it to a variable.
(and replace A2 with another variable which contains a date)
myvar = INT((mytoday - DATE(YEAR(mytoday),1,0)+6)/7)
but the whole DATE bit of the code doesn't work in VBA
How do I get this to work?
Cheers
=INT((A2- DATE(YEAR(A2),1,0)+6)/7)
where A2 is a cell containing todays date.
However, I want to use this formula in VBA to generate the same result, but attach it to a variable.
(and replace A2 with another variable which contains a date)
myvar = INT((mytoday - DATE(YEAR(mytoday),1,0)+6)/7)
but the whole DATE bit of the code doesn't work in VBA
How do I get this to work?
Cheers