Option Explicit
'このプロシージャから実行してください。
Sub main()
'セルのフォントの色(RGB値)を取得する
With Worksheets("Sheet1")
Debug.Print ("フォントの色(RGB値)は" & Cells(1, 1).Font.Color)
End With
'セルのフォントの色(RGB値)を設定する
With Worksheets("Sheet1")
Cells(1, 1).Font.Color = RGB(255, 0, 0)
Cells(1, 1).Value = RGB(255, 0, 0)
Cells(2, 1).Font.Color = RGB(0, 255, 0)
Cells(2, 1).Value = RGB(0, 255, 0)
Cells(3, 1).Font.Color = RGB(0, 0, 255)
Cells(3, 1).Value = RGB(0, 0, 255)
Cells(4, 1).Font.Color = RGB(255, 0, 255)
Cells(4, 1).Value = RGB(255, 0, 255)
End With
'セルのフォントの色(RGB値)を取得する
With Worksheets("Sheet1")
Debug.Print ("フォントの色(RGB値)は" & Cells(1, 1).Font.Color)
End With
End Sub
このサイトはリンクフリーです。リンクを貼る際に連絡は不要です。
© EXCEL VBA リファレンス all rights reserved.