簡體   English   中英

兩種不同的內部單元格顏色給我相同的colorIndex VBA

[英]Two different interior cell color give me the same colorIndex VBA

為什么兩個不同的單元格顏色給我相同的ColorIndex?

我使用此函數獲取單元格顏色索引:

Function InteriorColor(CellColor As Range)
 Application.Volatile
 InteriorColor = CellColor.Interior.ColorIndex
 End Function

這是函數返回的內容:

在此處輸入圖片說明

ColorIndex限制為256種顏色,因此可以將多種RGB顏色轉換為相同的ColorIndex。 使用.Color代替,在那里您可以使用更精確的RGB顏色。

Cells(1,1).Interior.Color = RGB(255,255,255)

ColorIndex涵蓋了非常有限的一組顏色值。

考慮改用Color

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM