Function Dec2Any(ByVal number As Long, ByVal base As Integer) As String
Dim index As Long Dim digits As String Dim digitValue As Long ' check base If base < 2 Or base > 36 Then Err.Raise 5 ' get the list of valid digits digits = Left("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", base) ' convert to the other base Do While number digitValue = number Mod base number = number \ base Dec2Any = Mid$(digits, digitValue + 1, 1) & Dec2Any Loop End Function |