Hi All,
I have a bit of VBA code to format a date into a year and week number format...
intweekstartn = Format(datestart, "yyyyww", 2)
So today would be 200627
The problem is if the week number is a single digit then it drops the leading zero, so it is returned as 20061 and not 200601. This causes a problem later in my code.
I "fixed" this with a few lines of code where I checked the length of what had been returned and if it was only 5 digits I added in the zero. But, I was wondering if there was a way to get format to always return the week number as 2 digits?
Thanks
I have a bit of VBA code to format a date into a year and week number format...
intweekstartn = Format(datestart, "yyyyww", 2)
So today would be 200627
The problem is if the week number is a single digit then it drops the leading zero, so it is returned as 20061 and not 200601. This causes a problem later in my code.
I "fixed" this with a few lines of code where I checked the length of what had been returned and if it was only 5 digits I added in the zero. But, I was wondering if there was a way to get format to always return the week number as 2 digits?
Thanks