Get_Background_Colour_selection_cells Function Below (Public)

PHOTO EMBED

Wed Sep 08 2021 04:25:46 GMT+0000 (UTC)

Saved by @Darkleech #vba

Public Function iColor(Rng As Range, Optional formatType As String) As Variant ' Linked with Get_Background_Colour_selection_cells Function Below
'formatType: Hex for #RRGGBB, RGB for (R, G, B) and IDX for VBA Color Index
    Dim colorVal As Variant
    colorVal = Rng.DisplayFormat.Interior.Color
    Select Case UCase(formatType)
        Case "HEX"
            iColor = "#" & Hex(colorVal Mod 256) & Hex((colorVal \ 256) Mod 256) & Hex((colorVal \ 65536))
        Case "RGB"
            iColor = (colorVal Mod 256) & ", " & ((colorVal \ 256) Mod 256) & ", " & (colorVal \ 65536)
        Case "IDX"
            iColor = Rng.Interior.ColorIndex
        Case Else
            iColor = colorVal
    End Select
End Function
content_copyCOPY