A列の塗り色をB列に範囲を指定してRGB表示します。
Sub OutputRGB()
Dim ws As Worksheet
Dim startRow As Long
Dim endRow As Long
Dim i As Long
Dim clr As Long
Dim r As Long, g As Long, b As Long
Set ws = ActiveSheet
startRow = CLng(InputBox("開始行を入力してください", "開始行"))
endRow = CLng(InputBox("終了行を入力してください", "終了行"))
If startRow > endRow Then
MsgBox "開始行は終了行以下にしてください。"
Exit Sub
End If
For i = startRow To endRow
clr = ws.Cells(i, "A").Interior.Color
r = clr Mod 256
g = (clr / 256) Mod 256
b = (clr / 65536) Mod 256
ws.Cells(i, "B").Value = "RGB(" & r & ", " & g & ", " & b & ")"
Next i
MsgBox "完了しました。"
End Sub
データを用意して実行すると・・・
開始行を指定し・・・
終了行を指定すれば・・・
完了です。
こんな感じになります。






