📜  excel vba 使用单元格内的十六进制颜色值突出显示单元格 - VBA 代码示例

📅  最后修改于: 2022-03-11 14:51:57.187000             🧑  作者: Mango

代码示例1
'VBA function to color cells in selected range based on the hex
'color number entered in each cell. For example, #FF69B4

Sub ColorCellsByHex()
    Dim r
    If TypeName(Selection) <> "Range" Then Exit Sub
    For Each r In Selection
        r.Interior.Color = Abs(("&H" & Mid(r, 6, 2) & Mid(r, 4, 2) & Mid(r, 2, 2)))
    Next
End Sub