Article ID: 140035
Article Last Modified on 10/11/2006
Function Base(InValue As Double, NewBase As Double) As String
Dim TestVal As Double, counter As Integer, Alpha As String
Dim Holder As Integer
Application.Volatile
On Error GoTo FixError
If InValue = 0 Then GoTo FixError
If NewBase = 0 Then GoTo FixError
counter = 0
TestVal = 0
While TestVal < InValue
TestVal = NewBase ^ counter
If TestVal < InValue Then counter = counter + 1
Wend
counter = counter - 1
Alpha = ""
Holder = 0
For x = counter To 0 Step -1
Holder = Int(InValue / (NewBase ^ x))
Alpha = Alpha & Application.Text(Holder, "0")
InValue = InValue - (Holder * (NewBase ^ x))
Next x
Base = Alpha
Exit Function
FixError:
Base = "#Value"
End Function
Additional query words: 5.00a 5.00c 7.00a XL98 XL97 XL7 XL5 XL
Keywords: kbdtacode kberrmsg kbhowto kbprogramming KB140035