VBA 16進位轉10進位
Function HextoDec(hex As String)
Dim i As Byte, l As Byte, d As String, dec As Long
l = Len(hex)
For i = 1 To l
d = Mid(hex, i, 1)
If Not d Like "[0-9]" Then
Select Case d
Case "A"
d = "10"
Case "B"
d = "11"
Case "C"
d = "12"
Case "D"
d = "13"
Case "E"
d = "14"
Case "F"
d = "15"
End Select
End If
dec = dec + CByte(d) * 16 ^ (l - i)
Next i
HextoDec = dec
End Function
留言