skyline666
Programmer
Hi,
I have this code below which is used to show what the highest denomination a value is (meaning the number 45's highest denomination is 10 (the ten figure), 852's is 100 (the hundred figure)).
Here is the two examples above in the immediate window:
?denom(45)
10
?denom(852)
100
What I would like to do is turn the select case into a for loop, so if say I want it to go to 1,000,000,000 or more, then I don't need to have 10 or more case statements in. Also it would look much tidier.
Any help on this will be much appreciated,
Andrew
PS. Did there used to be a Preview Post button before aswell as the submit button?
I have this code below which is used to show what the highest denomination a value is (meaning the number 45's highest denomination is 10 (the ten figure), 852's is 100 (the hundred figure)).
Code:
Function denom(lngField As String) As Long
Dim intLen As Long
Dim lngDenominator As Long
intLen = Len(lngField)
Select Case intLen
Case 1
lngDenominator = 1
Case 2
lngDenominator = 10
Case 3
lngDenominator = 100
Case 4
lngDenominator = 1000
End Select
denom = lngDenominator
End Function
Here is the two examples above in the immediate window:
?denom(45)
10
?denom(852)
100
What I would like to do is turn the select case into a for loop, so if say I want it to go to 1,000,000,000 or more, then I don't need to have 10 or more case statements in. Also it would look much tidier.
Any help on this will be much appreciated,
Andrew
PS. Did there used to be a Preview Post button before aswell as the submit button?