hiroemon_ さんの引用:
L列が条件付き書式を設定しており、その隣の列Mに、
黄色の付いたセルが、
色付き = "1"
色なし = "0"
を表示したいです。
背景色のみです。フォントはなしで大丈夫です。
(標準モジュール)
----------------------------------------------------------------------
Sub CountCellsByInteriorColor()
Const EvaluatedColumn = "L"
Dim wsSheet As Worksheet
Dim lngFirstRow As Long
Dim lngLastRow As Long
Set wsSheet = ThisWorkbook.Worksheets(1)
lngFirstRow = 1
lngLastRow = wsSheet.Cells(wsSheet.Rows.Count, EvaluatedColumn).End(xlUp).Row
Dim rngCell As Range
Dim lngRow As Long
Dim lngCount As Long
lngCount = 0
For lngRow = lngFirstRow To lngLastRow
Set rngCell = wsSheet.Cells(lngRow, EvaluatedColumn)
If rngCell
.DisplayFormat.Interior.Color = RGB(255, 255, 0) Then
lngCount = lngCount + 1
rngCell.Offset(0, 1).Value = 1
Else
rngCell.Offset(0, 1).Value = 0
End If
Set rngCell = Nothing
Next
Set wsSheet = Nothing
MsgBox lngCount & " 件"
End Sub
----------------------------------------------------------------------
以上のようなコードを実行なさればよろしいのではないかと。