我以前写的,转几亿位应该都是可以的,只要你的系统还可以:
Private Sub Form_Click()
Dim start As Long
Const hugenum = "1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"
start = Timer
MsgBox dectohex(hugenum), , "it take me about " & Format((Timer - start), "0.0000") & " seconds to trans the hugenum to hex"
End Sub
Function half(ByVal x As String) As String 'get half of x
x = 0 & x
Dim i As Long
ReDim result(2 To Len(x)) As String
For i = 2 To Len(x)
result(i) = CStr(Val(Mid(x, i, 1)) \ 2 + IIf(Val(Mid(x, i - 1, 1)) Mod 2 = 1, 5, 0))
Next
half = Join(result, "")
If Left(half, 1) = "0" Then half = Right(half, Len(half) - 1) ' no zero ahead
End Function
Function dectohex(ByVal hugenum As String) As String ' trans hugenum to hex
Do While Len(hugenum) > 2
dectohex = Hex(Val(Right(hugenum, 4)) Mod 16) & dectohex
For i = 1 To 4 'devide hugenum by 16
hugenum = half(hugenum)
Next
Loop
dectohex = Hex(Val(hugenum)) & dectohex
End Function