Hi, I am trying to format a number to add leading zeroes in a function I have created. The input Integer will have a maximum length of 5 characters, but the output must be five characters with the proper number of leading zeroes. I tried using the format function (ie. Format(Strike, "00000"), but the output only gives me the input strike. Here is an example:
If the Strike input equals 25.5 then the OSI output should be 00025. With this I am only getting 25.
I appreciate the help!
Code:
Public Function OSI(Strike As String)
'Declare variable to format Dollar Strike
Dim IntDollar As Single
Dim aDollar As Single
'Dollar Strike format
IntDollar = Int(Strike)
aDollar = Format(IntDollar, 00000)
'Output
OSI = aDollar
End Function
If the Strike input equals 25.5 then the OSI output should be 00025. With this I am only getting 25.
I appreciate the help!