Hex Function

Returnerar en strÀng som innehÄller en hexadecimal representation av ett tal.

Syntax:

Hex (Tal)

ReturvÀrde:

String

Parametrar:

Tal: Ett numeriskt uttryck som ska konverteras till ett hexadecimalt tal.

Error codes:

5 Felaktigt proceduranrop

Exempel:

Sub ExampleHex

' AnvÀnder Basic-formler i LibreOffice Calc

Dim a2, b2, c2 As String

    a2 = "&H3E8"

    b2 = Hex2Int(a2)

    MsgBox b2

    c2 = Int2Hex(b2)

    MsgBox c2

End Sub

 

Function Hex2Int( sHex As String ) As Long

' Returnerar ett heltal av typen Long frÄn ett hexadecimalt vÀrde.

    Hex2Int = clng( sHex )

End Function

 

Function Int2Hex( iLong As Long) As String

' Returnerar ett hexadecimalt vÀrde givet ett heltal.

    Int2Hex = "&H" & Hex( iLong )

End Function