I'm trying to make a VBScript produce a counter with this format: YY/nn (16/1 - 16/2).
It has to handle numbers up to 4 characters (16/100, 16/1055).
I have found this code, who does the job, but it displays leading zeroes (16/0001), how can i remove the leading zeroes from the output and meet the requirements?
***CODE START ***
Dim yy, nn
yy = Right(Year(Date()),2)
If isnull(LastUsed) or (LastUsed="") Then
nn = 1
ElseIf Left(LastUsed,2)=yy Then
nn = CInt(Right(LastUsed,4)) + 1
Else
nn = 1
End If
Output = yy & "/" & Right("0000" & nn,4)
***CODE END***
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Expert of the Year award recognizes an expert who helped improve Experts Exchange in the past year through high levels of contributions and participation on site. This award is given to the expert who has achieved the highest levels of participation, while maintaining quality contributions and professionalism.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.