Mengubah Bilangan Hexa Ke Decimal

Mengubah Bilangan Hexa Ke Decimal


Private Function HextoDec(HexNum As String) As Long
Dim xx%, yy%
For xx = 1 To Len(HexNum)
If Asc(Mid(HexNum, xx, 1)) <> 57 And _
Asc(Mid(HexNum, xx, 1)) <> 70 And _
Asc(Mid(HexNum, xx, 1)) <> 102 Then GoTo HexError
Next xx
HextoDec = "&h" & HexNum
Exit Function
HexError:
hextodectemp = MsgBox(UCase(HexNum) & " bukan bilangan hexa", _
vbOKOnly + vbCritical, "Hex2Dec")
End Function


Private Sub Command1_Click()
MsgBox HextoDec("FFF")
End Sub

4 comments: