Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Formatierung von Hex-Zahlen per VBA

76 views
Skip to first unread message

Anja

unread,
Dec 5, 2002, 2:48:14 AM12/5/02
to
Hallo Newsgroup,
ich habe ein Problem beim Formatieren von Hex-Werten per
VBA:
Folgende Funktion habe ich:

sub test()
dim z as string
dim num1 as long
dim num2 as long

num1 = &H10
num2 = &HE0
z= Format(Hex(num1),"00 00 00 00 ") & vbcr & _
Format(Hex(num2),"00 00 00 00 ")

msgbox z
end sub

Das Ergebnis ist folgendes:
00 00 00 10 (=richtig)
E0 (=falsch, es müsste 00 00 00 E0 heißen!)

Kann mir jemand helfen?

Gruß Anja

Frank Arendt-Theilen

unread,
Dec 5, 2002, 3:13:24 AM12/5/02
to
Hallo Anja,
die Funktion Hex() gibt einen String zurück. Der Hex-Wert 10 wird im
VBA auch als Zahlwert erkannt und die Formatierung deshalb angwandt.
Der Hewx-Wert E0 ist und bleibt ein String auf dem die Formatierung
nicht angewandt werden kann. Daher die Unterschiede.

MfG Frank
_________________________________________________
Frank Arendt-Theilen, Microsoft MVP für Excel, Hameln
eMail: Thei...@t-online.de, Homepage: http://www.xl-faq.de

0 new messages