' 输入:Dec(十进制数)
' 输入数据类型:Long
' 输出:DEC_to_HEX(十六进制数)
' 输出数据类型:String
' 输入的最大数为2147483647,输出最大数为7FFFFFFF
Public Function DEC_to_HEX(Dec As Long) As String
Dim a As String
DEC_to_HEX = ""
Do While Dec >0
a = CStr(Dec Mod 16)
Select Case a
Case "10": a = "A"
Case "11": a = "B"
Case "12": a = "C"
Case "13": a = "D"
Case "14": a = "E"
Case "15": a = "F"
End Select
DEC_to_HEX = a &DEC_to_HEX
Dec = Dec \ 16
Loop
End Function
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)