Hallo Forum.
Ich möchte mir eigene Variablen für häufig genutzte Farben definieren. Entsprechend verschiedenen Beispielen im Internet habe ich das als Hex-Variable definiert. Doch wenn ich diese Variable benutze, erscheint eine ganz andere Farbe.
Mein Code:
Sub Farbe()
Const UVbBraun As Long = &H808080
Const UVbOrange1 As Long = 42495
Const UVbOrange2 As Long = &HFFA5
Debug.Print "UvbBraun " & Hex(UVbBraun)
Debug.Print "UVbOrange1 " & Hex(UVbOrange1)
Debug.Print "UVbOrange2 " & Hex(UVbOrange2)
Cells(1, 1).Interior.Color = UVbOrange1
Cells(1, 3).Interior.Color = RGB(255, 165, 0)
Cells(3, 1).Interior.Color = UVbOrange2
Cells(3, 3).Interior.Color = RGB(255, 165, 0)
Cells(5, 1).Interior.Color = UVbBraun
Cells(5, 3).Interior.Color = RGB(128, 128, 128)
Debug.Print "Cells(1, 1) " & Cells(1, 1).Interior.Color & " " & Hex(Cells(1, 1).Interior.Color)
Debug.Print "Cells(1, 3) " & Cells(1, 3).Interior.Color & " " & Hex(Cells(1, 1).Interior.Color)
Debug.Print "Cells(3, 1) " & Cells(3, 1).Interior.Color & " " & Hex(Cells(3, 1).Interior.Color)
Debug.Print "Cells(3, 3) " & Cells(3, 3).Interior.Color & " " & Hex(Cells(3, 3).Interior.Color)
Debug.Print "Cells(5, 1) " & Cells(5, 1).Interior.Color & " " & Hex(Cells(5, 1).Interior.Color)
Debug.Print "Cells(5, 3) " & Cells(5, 3).Interior.Color & " " & Hex(Cells(5, 3).Interior.Color)
End Sub
Meine Print-Outs:
Cells(1, 1) 42495 A5FF
Cells(1, 3) 42495 A5FF
Cells(3, 1) 16777125 FFFFA5
Cells(3, 3) 42495 A5FF
Cells(5, 1) 8421504 808080
Cells(5, 3) 8421504 808080
Meine Frage:
Was ist an der Definition "UVbOrange2" falsch?
Gruß Joschi