EXCEL フォントの色を取得する関数

フォントの色を取得する関数

 

Option Explicit

 

Function FontColor(ByVal Data As Range) As Variant

 

FontColor = Cells(Data.Row, Data.Column).Font.Color

 

End Function

 

Function FontColorRGB(ByVal Data As Range) As Variant

 

FontColorRGB = "RGB(" & Val("&H" & Right$("00" & Hex(Cells(Data.Row, Data.Column).Font.Color), 2)) & ", " _

                      & Val("&H" & Left$(Right$("0000" & Hex(Cells(Data.Row, Data.Column).Font.Color), 4), 2)) & ", " _

                      & Val("&H" & Left$(Right$("00000" & Hex(Cells(Data.Row, Data.Column).Font.Color), 6), 2)) & ")"


End Function
  

以上。